aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/documentation.tex36
-rw-r--r--param.ccl109
-rw-r--r--schedule.ccl10
-rw-r--r--src/ChooseOutput.c64
-rw-r--r--src/DumpGH.c18
-rw-r--r--src/Output.c132
-rw-r--r--src/Output2D.c209
-rw-r--r--src/RecoverGH.c22
-rw-r--r--src/RestoreFile.c6
-rw-r--r--src/Startup.c71
-rw-r--r--src/Write.c34
-rw-r--r--src/Write2D.c8
-rw-r--r--src/ioFlexGH.h27
-rw-r--r--test/checkpoint.parfile11
-rw-r--r--test/test_recover.par5
15 files changed, 398 insertions, 364 deletions
diff --git a/doc/documentation.tex b/doc/documentation.tex
index defad82..e0f91c5 100644
--- a/doc/documentation.tex
+++ b/doc/documentation.tex
@@ -7,12 +7,12 @@
\date{1998-1999}
\maketitle
-\abstract{Thorn IOFlexIO provides I/O methods to output variables in IEEEIO
+\abstract{Thorn {\bf IOFlexIO} provides I/O methods to output variables in IEEEIO
file format. It also implements checkpointing/recovery functionality.}
%
\section{Purpose}
%
-Thorn IOFlexIO uses John Shalf's FlexIO library (see {\tt
+Thorn {\bf IOFlexIO} uses John Shalf's FlexIO library (see {\tt
http://bach.ncsa.uiuc.edu/FlexIO/} for details) to output any type of grid
variables (grid scalars, grid functions, and arrays of arbitrary dimension)
in the IEEEIO file format.\\
@@ -20,32 +20,32 @@ in the IEEEIO file format.\\
The thorn registers two I/O methods with the flesh's I/O interface at startup:
%
\begin{itemize}
- \item method {\tt IOFlexIO\_3D} outputs all types of grid variables with
+ \item method {\tt IOFlexIOD} outputs all types of grid variables with
arbitrary dimensions
\item method {\tt IOFlexIO\_2D} outputs two-dimensional slices (xy-, xz-,
and yz-slice) of three-dimensional grid functions and arrays
\end{itemize}
-Data is written into files named {\tt "<varname>.ieee"} (for method {\tt IOFlexIO\_3D}) and {\tt "<varname>\_2d\_<plane>.ieee"} (for method {\tt IOFlexIO\_2D}).
+Data is written into files named {\tt "<varname>.ieee"} (for method {\tt IOFlexIO}) and {\tt "<varname>\_2d\_<plane>.ieee"} (for method {\tt IOFlexIO\_2D}).
Such datafiles can be used for further postprocessing (eg. visualization)
or fed back into Cactus via the filereader capabilities of thorn IOUtil.\\[3ex]
\subsection{Parallel File I/O}
-According to the ouptput mode parameter settings ({\tt IO::out3D\_mode,
-IO::out3D\_unchunked, IO::out3D\_procs}) of thorn IOUtil, thorn IOFlexIO
+According to the ouptput mode parameter settings ({\tt IO::out\_mode,
+IO::out\_unchunked, IO::out\_proc\_every}) of thorn {\bf IOUtil}, thorn {\bf IOFlexIO}
will output distributed data either
\begin{itemize}
\item in serial into a single unchunked file
\begin{verbatim}
- IO::out3D_mode = "onefile"
- IO::out3D_unchunked = "yes"
+ IO::out_mode = "onefile"
+ IO::out_unchunked = "yes"
\end{verbatim}
\item in parallel, that is, into separate files containing chunks of the
individual processors' patches of the distributed array
\begin{verbatim}
- IO::out3D_mode = "proc | np"
+ IO::out_mode = "proc | np"
\end{verbatim}
\end{itemize}
The default is to output data in parallel, in order to get maximum I/O
@@ -97,14 +97,14 @@ the current working directory:
\subsection{Checkpointing \& Recovery}
-Thorn IOFlexIO can also be used for creating IEEEIO checkpoint files and
+Thorn {\bf IOFlexIO} can also be used for creating IEEEIO checkpoint files and
recovering from such files later on.\\
Checkpoint routines are scheduled at several timebins so that you can save
the current state of your simulation atfer the initial data phase,
during evolution, or at termination.
A recovery routine is registered with thorn IOUtil in order to restart
-a new simulation from a given IOFlexIO checkpoint.
+a new simulation from a given {\bf IOFlexIO} checkpoint.
The very same recovery mechanism is used to implement a filereader
functionality to feed back data into Cactus.\\
@@ -115,14 +115,14 @@ to this thorn's documentation).
\section{Comments}
-\subsection{Importing external data into Cactus with IOFlexIO}
+\subsection{Importing external data into Cactus with {\bf IOFlexIO}}
In order to import external data into Cactus (eg. to initialize some variable)
you first need to convert this data into an IEEEIO datafile which then can be
-processed by the registered recovery routine of thorn IOFlexIO.\\
+processed by the registered recovery routine of thorn {\bf IOFlexIO}.\\
The following description explains the IEEEIO file layout of an unchunked
-datafile which thorn IOFlexIO expects in order to restore Cactus variables
+datafile which thorn {\bf IOFlexIO} expects in order to restore Cactus variables
from it properly. There is also a well-documented example C program provided
({\tt IOFlexIO/doc/CreateIOFlexIOdatafile.c}) which illustrates how to create
a datafile with IEEEIO file layout. This working example can be used as a
@@ -133,7 +133,7 @@ template for building your own data converter program.\\
\item The type of your data as well as its dimensions are already
inherited by a dataset itself as metainformation. But this is not
- enough for IOFlexIO to savely match it against a specific Cactus
+ enough for {\bf IOFlexIO} to savely match it against a specific Cactus
variable.
For that reason, the variable's name, its groupname, its grouptype, the
timelevel to restore, and the
@@ -173,15 +173,15 @@ it would probably not make much sense to feed this datafile into Cactus for
initializing your x coordinate grid function :-)
%
%
-\subsection{Other utility programs in IOFlexIO}
+\subsection{Other utility programs in {\bf IOFlexIO}}
%
-In addition to the IEEEIO recombiner program, thorn IOFlexIO also provides
+In addition to the IEEEIO recombiner program, thorn {\bf IOFlexIO} also provides
some other utilities which can be build the same way:
%
\begin{itemize}
\item {\tt ieee\_merge.c}\\
Merges the contents of its input files into a single output file.\\
- This might be useful for IOFlexIO datafile created by different runs.
+ This might be useful for {\bf IOFlexIO} datafile created by different runs.
\item {\tt ieee\_extract.c}\\
Extracts a hyperslab from all datasets of the input file.\\
You can select a hyperslab by specifying an origin and an extent (eg.
diff --git a/param.ccl b/param.ccl
index 7db18a0..9b03ef5 100644
--- a/param.ccl
+++ b/param.ccl
@@ -1,4 +1,5 @@
# Parameter definitions for thorn IOFlexIO
+# $Header$
#############################################################################
### declare IOFlexIO parameters
@@ -9,29 +10,48 @@ private:
########################
# How often to do output
########################
-INT out2D_every "How often to do 2D output, overrides out_every" STEERABLE = ALWAYS
+INT out2D_every "How often to do 2D IOFlexIO output, overrides IO::out_every" STEERABLE = ALWAYS
{
- -1 :: "Never"
- 1:* :: "Every so many iterations"
+ 1:* :: "Every so many iterations"
+ 0: :: "Disable 2D IOFlexIO output"
+ -1: :: "Default to IO::out_every"
} -1
-
-INT out3D_every "How often to do 3D output, overrides out_every" STEERABLE = ALWAYS
+INT out_every "How often to do IOFlexIO output, overrides IO::out_every" STEERABLE = ALWAYS
+{
+ 1:* :: "Every so many iterations"
+ 0: :: "Disable IOFlexIO output"
+ -1: :: "Default to IO::out_every"
+} -1
+INT out3D_every "How often to do IOFlexIO output, overrides IO::out_every (DEPRECATED IN BETA12)" STEERABLE = ALWAYS
{
- -1 :: "Never"
- 1:* :: "Every so many iterations"
+ 1:* :: "Every so many iterations"
+ 0: :: "Disable IOFlexIO output"
+ -1: :: "Default to IO::out_every"
} -1
####################
# Output directories
####################
-STRING outdir2D "Name of IO 2D output directory, overrides IO::outdir"
+STRING out2D_dir "Output directory for 2D IOFlexIO files, overrides IO::out_dir" STEERABLE = RECOVER
{
- .* :: "Any valid directory name, an empty string defaults to outdir"
-} ""
-STRING outdir3D "Name of IO 3D output directory, overrides IO::outdir"
+ ".+" :: "A valid directory name"
+ "^$" :: "An empty string to choose the default from IO::out_dir"
+} ""
+STRING out_dir "Output directory for IOFlexIO files, overrides IO::out_dir" STEERABLE = RECOVER
+{
+ ".+" :: "A valid directory name"
+ "^$" :: "An empty string to choose the default from IO::out_dir"
+} ""
+STRING outdir2D "Output directory for 2D IOFlexIO files, overrides IO::out_dir (DEPRECATED IN BETA13)" STEERABLE = RECOVER
{
- .* :: "Any valid directory name, an empty string defaults to outdir"
+ ".+" :: "A valid directory name"
+ "^$" :: "An empty string to choose the default from IO::out_dir"
+} ""
+STRING outdir3D "Output directory for IOFlexIO files, overrides IO::out_dir (DEPRECATED IN BETA13)" STEERABLE = RECOVER
+{
+ ".+" :: "A valid directory name"
+ "^$" :: "An empty string to choose the default from IO::out_dir"
} ""
@@ -40,11 +60,18 @@ STRING outdir3D "Name of IO 3D output directory, overrides IO::outdir"
##########################
STRING out2D_vars "Variables to output in 2D FlexIO file format" STEERABLE = ALWAYS
{
- .* :: "A regex which matches everything"
+ ".+" :: "Space-separated list of fully qualified variable/group names"
+ "^$" :: "An empty string to output nothing"
} ""
-STRING out3D_vars "Variables to output in 3D FlexIO file format" STEERABLE = ALWAYS
+STRING out_vars "Variables to output in FlexIO file format" STEERABLE = ALWAYS
{
- .* :: "A regex which matches everything"
+ ".+" :: "Space-separated list of fully qualified variable/group names"
+ "^$" :: "An empty string to output nothing"
+} ""
+STRING out3D_vars "Variables to output in FlexIO file format (DEPRECATED IN BETA12)" STEERABLE = ALWAYS
+{
+ ".+" :: "Space-separated list of fully qualified variable/group names"
+ "^$" :: "An empty string to output nothing"
} ""
@@ -97,50 +124,28 @@ CCTK_INT out2D_yzplane_xi "x-index (from 0) for 2D planes in yz"
#############################################################################
shares: IO
-####################
-# Output directories
-####################
-USES STRING outdir
-
-########################
-# How often to do output
-########################
-USES INT out_every
+# FIXME: want USES STRING out_dir AS default_out_dir
+# FIXME: want USES INT out_every AS default_out_every
-###########################
-# Which 2D slices to output
-###########################
-USES CCTK_REAL out_yzplane_x
-USES CCTK_REAL out_xzplane_y
+USES CCTK_REAL out_yzplane_x
+USES CCTK_REAL out_xzplane_y
USES CCTK_REAL out_xyplane_z
-USES CCTK_INT out_xyplane_zi
-USES CCTK_INT out_xzplane_yi
-USES CCTK_INT out_yzplane_xi
+USES CCTK_INT out_xyplane_zi
+USES CCTK_INT out_xzplane_yi
+USES CCTK_INT out_yzplane_xi
-################
-# various things
-################
-USES BOOLEAN verbose
-USES BOOLEAN newverbose
-USES BOOLEAN out3D_parameters
+USES KEYWORD verbose
USES BOOLEAN print_timing_info
-USES KEYWORD out_fileinfo
-
-#######################
-# Specific to 3D output
-#######################
-USES KEYWORD out3D_mode
-USES BOOLEAN out3D_septimefiles
+USES KEYWORD out_mode
+USES KEYWORD out_fileinfo
+USES KEYWORD out_save_parameters
+USES INT out_timesteps_per_file
-###################################
-# Checkpointing/recovery parameters
-###################################
+USES INT checkpoint_every
+USES INT checkpoint_keep
USES BOOLEAN checkpoint_ID
-USES BOOLEAN checkpoint_keep_all
USES BOOLEAN recover_and_remove
-USES INT checkpoint_every
USES BOOLEAN checkpoint_on_terminate
-USES INT checkpoint_keep
USES KEYWORD recover
-USES STRING recover_file
+USES STRING recover_file
diff --git a/schedule.ccl b/schedule.ccl
index ae3c1e7..e2e8a75 100644
--- a/schedule.ccl
+++ b/schedule.ccl
@@ -9,7 +9,7 @@ schedule IOFlexIO_Startup at STARTUP after ( IOUtil_Startup Driver_Startup )
LANG:C
} "Startup routine"
-schedule IOFlexIO_TerminateGH at CCTK_TERMINATE after IOFlexIO_TerminationCheckpoint
+schedule IOFlexIO_TerminateGH at TERMINATE after IOFlexIO_TerminationCheckpoint
{
LANG:C
} "Closing open IEEEIO files"
@@ -27,24 +27,24 @@ schedule IOFlexIO_Choose2D at BASEGRID after SpatialCoordinates
########################################################################
### register checkpoint/recovery routines
########################################################################
-schedule IOFlexIO_InitialDataCheckpoint at CCTK_CPINITIAL
+schedule IOFlexIO_InitialDataCheckpoint at CPINITIAL
{
LANG:C
} "Initial data checkpoint routine"
-schedule IOFlexIO_EvolutionCheckpoint at CCTK_CHECKPOINT
+schedule IOFlexIO_EvolutionCheckpoint at CHECKPOINT
{
LANG:C
} "Evolution data checkpoint routine"
-schedule IOFlexIO_TerminationCheckpoint at CCTK_TERMINATE BEFORE Driver_Terminate
+schedule IOFlexIO_TerminationCheckpoint at TERMINATE BEFORE Driver_Terminate
{
LANG:C
} "Termination checkpoint routine"
if (! CCTK_Equals (recover, "no") && *recover_file)
{
- schedule IOFlexIO_RecoverParameters at CCTK_RECOVER_PARAMETERS
+ schedule IOFlexIO_RecoverParameters at RECOVER_PARAMETERS
{
LANG:C
} "Parameter recovery routine"
diff --git a/src/ChooseOutput.c b/src/ChooseOutput.c
index 896af8c..aa83e01 100644
--- a/src/ChooseOutput.c
+++ b/src/ChooseOutput.c
@@ -29,32 +29,17 @@ CCTK_FILEVERSION(CactusPUGHIO_IOFlexIO_ChooseOutput_c)
3. Coords from IOFlexIO
4. Coords from IOUtil
*/
-#define GET_SLICE(my_param, IOUtil_param, origin_index, origin_phys) \
+#define GET_SLICE(IOFlexIO_param, IOUtil_param, index, coord) \
{ \
- origin_index = -1; \
- if (CCTK_ParameterQueryTimesSet (#my_param "i", "IOFlexIO") > 0) \
- { \
- origin_index = my_param##i; \
- } \
- else if (CCTK_ParameterQueryTimesSet (#IOUtil_param "i", "IOUtil")>0)\
- { \
- origin_index = IOUtil_param##i; \
- } \
- else if (CCTK_ParameterQueryTimesSet (#my_param, "IOFlexIO") > 0) \
- { \
- origin_phys = my_param; \
- } \
- else \
- { \
- origin_phys = IOUtil_param; \
- } \
+ index = IOFlexIO_param##i >= 0 ? IOFlexIO_param##i : IOUtil_param##i;\
+ coord = IOFlexIO_param != -424242 ? IOFlexIO_param : IOUtil_param; \
}
/********************************************************************
******************** External Routines ************************
********************************************************************/
-void IOFlexIO_Choose2D (cGH *GH);
+void IOFlexIO_Choose2D (const cGH *GH);
/*@@
@@ -64,38 +49,39 @@ void IOFlexIO_Choose2D (cGH *GH);
@desc
Use parameters to choose the 2D planes through the output data.
@enddesc
+
+ @calls IOUtil_2DPlanes
+
+ @var GH
+ @vdesc pointer to CCTK grid hierarchy
+ @vtype const cGH *
+ @vio in
+ @endvar
@@*/
-void IOFlexIO_Choose2D (cGH *GH)
+void IOFlexIO_Choose2D (const cGH *GH)
{
- int i;
+ int i, maxdim;
flexioGH *myGH;
int origin_index[3];
CCTK_REAL origin_phys[3];
DECLARE_CCTK_PARAMETERS
- /* get the handle for IOFlexIO extensions */
+ GET_SLICE (out2D_xyplane_z, out_xyplane_z, origin_index[0], origin_phys[0]);
+ GET_SLICE (out2D_xzplane_y, out_xzplane_y, origin_index[1], origin_phys[1]);
+ GET_SLICE (out2D_yzplane_x, out_yzplane_x, origin_index[2], origin_phys[2]);
+
+ maxdim = CCTK_MaxDim ();
myGH = (flexioGH *) CCTK_GHExtension (GH, "IOFlexIO");
- if (myGH == NULL)
- {
- CCTK_WARN (1, "IOFlexIO_Choose2D: IOFlexIO GH extension not found");
- }
- else
+ myGH->sp2xyz = (int **) malloc (3 * sizeof (int *));
+
+ for (i = 0; i < maxdim; i++)
{
- GET_SLICE (out2D_xyplane_z, out_xyplane_z, origin_index[0], origin_phys[0]);
- GET_SLICE (out2D_xzplane_y, out_xzplane_y, origin_index[1], origin_phys[1]);
- GET_SLICE (out2D_yzplane_x, out_yzplane_x, origin_index[2], origin_phys[2]);
+ myGH->sp2xyz[i] = (int *) calloc (i + 1, sizeof (int));
- for (i = 1; i <= CCTK_MaxDim (); i++)
+ if (i > 0 && i < 3)
{
- if (i > 1 && i <= 3)
- {
- IOUtil_2DPlanes (GH, i, origin_index, origin_phys, myGH->sp2xyz[i-1]);
- }
- else
- {
- memset (myGH->sp2xyz[i-1], 0, i * sizeof (myGH->sp2xyz[i-1][0]));
- }
+ IOUtil_2DPlanes (GH, i + 1, origin_index, origin_phys, myGH->sp2xyz[i]);
}
}
}
diff --git a/src/DumpGH.c b/src/DumpGH.c
index beab46f..9f23ac7 100644
--- a/src/DumpGH.c
+++ b/src/DumpGH.c
@@ -95,7 +95,7 @@ void IOFlexIO_EvolutionCheckpoint (const cGH *GH)
((checkpoint_every > 0 && GH->cctk_iteration % checkpoint_every == 0) ||
checkpoint_next))
{
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_INFO("------------------------------------------------------------");
CCTK_VInfo (CCTK_THORNSTRING, "Dumping periodic checkpoint file at "
@@ -310,7 +310,7 @@ static int Checkpoint (const cGH *GH, int called_from)
/* allocate the ring buffer for checkpoint filenames */
if (! cp_filenames)
{
- cp_filenames = (char **) calloc (checkpoint_keep, sizeof (char *));
+ cp_filenames = (char **) calloc (abs (checkpoint_keep), sizeof (char *));
}
/* start the total timer */
@@ -333,7 +333,7 @@ static int Checkpoint (const cGH *GH, int called_from)
/* now open the file */
if (myproc == ioUtilGH->ioproc)
{
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, "Creating file '%s'", tmpfilename);
}
@@ -361,7 +361,7 @@ static int Checkpoint (const cGH *GH, int called_from)
/* first dump the parameters ... */
if (file)
{
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_INFO ("Dumping Params ...");
}
@@ -378,7 +378,7 @@ static int Checkpoint (const cGH *GH, int called_from)
}
/* ... now the variables, sorted by groups */
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_INFO ("Dumping Grid Variables ...");
}
@@ -421,7 +421,7 @@ static int Checkpoint (const cGH *GH, int called_from)
request->timelevel < gdata.numtimelevels;
request->timelevel++)
{
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
fullname = CCTK_FullName (request->vindex);
CCTK_VInfo (CCTK_THORNSTRING, " %s (timelevel %d)",
@@ -448,7 +448,7 @@ static int Checkpoint (const cGH *GH, int called_from)
if (myproc == ioUtilGH->ioproc)
{
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, "Closing and renaming checkpoint file "
"into '%s'", filename);
@@ -471,14 +471,14 @@ static int Checkpoint (const cGH *GH, int called_from)
and put the new filename into the ring buffer */
if (cp_filenames[cp_fileindex])
{
- if (! checkpoint_keep_all)
+ if (checkpoint_keep > 0)
{
remove (cp_filenames[cp_fileindex]);
}
free (cp_filenames[cp_fileindex]);
}
cp_filenames[cp_fileindex] = strdup (filename);
- cp_fileindex = (cp_fileindex + 1) % checkpoint_keep;
+ cp_fileindex = (cp_fileindex + 1) % abs (checkpoint_keep);
/* stop total checkpoint timer and print timing info */
if (myGH->print_timing_info)
diff --git a/src/Output.c b/src/Output.c
index 776a473..d877f29 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 "ioFlexGH.h"
/* the rcs ID and its dummy function to use it */
@@ -35,9 +36,8 @@ static void CheckSteerableParameters (const cGH *GH);
Loops over all variables and outputs them if necessary
@enddesc
- @calls CheckSteerableParameters
- IOFlexIO_TimeFor
- IOFlexIO_OutputVarAs
+ @calls IOFlexIO_TimeFor
+ IOFlexIO_Write
@var GH
@vdesc pointer to CCTK GH
@@ -55,41 +55,20 @@ int IOFlexIO_OutputGH (const cGH *GH)
{
int vindex, retval;
const flexioGH *myGH;
- char *fullname;
- const char *name;
- DECLARE_CCTK_PARAMETERS
-
- CheckSteerableParameters (GH);
+ retval = 0;
myGH = (const flexioGH *) CCTK_GHExtension (GH, "IOFlexIO");
- if (myGH->out_every <= 0)
- {
- return (0);
- }
/* loop over all variables */
- for (vindex = retval = 0; vindex < CCTK_NumVars (); vindex++)
+ for (vindex = CCTK_NumVars () - 1; vindex >= 0; vindex--)
{
- if (IOFlexIO_TimeFor (GH, vindex))
+ if (IOFlexIO_TimeFor (GH, vindex) &&
+ IOFlexIO_Write (GH, vindex, CCTK_VarName (vindex)) == 0)
{
- name = CCTK_VarName (vindex);
- fullname = CCTK_FullName (vindex);
-
- if (verbose)
- {
- CCTK_VInfo (CCTK_THORNSTRING, "IOFlexIO_OutputGH: "
- "(fullname, name) = (%s, %s)", fullname, name);
- }
-
- if (IOFlexIO_OutputVarAs (GH, fullname, name) == 0)
- {
- /* register variables as having output this iteration */
- myGH->out_last[vindex] = GH->cctk_iteration;
- retval++;
- }
-
- free (fullname);
+ /* register variable as having output this iteration */
+ myGH->out_last[vindex] = GH->cctk_iteration;
+ retval++;
}
}
@@ -140,7 +119,7 @@ int IOFlexIO_OutputVarAs (const cGH *GH, const char *fullname, const char*alias)
vindex = CCTK_VarIndex (fullname);
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, "IOFlexIO_OutputVarAs: (fullname, alias, "
"index) = (%s, %s, %d)", fullname, alias, vindex);
@@ -204,9 +183,9 @@ int IOFlexIO_TimeFor (const cGH *GH, int vindex)
CheckSteerableParameters (GH);
/* check if this variable should be output */
- myGH = (flexioGH *) CCTK_GHExtension (GH, "IOFlexIO");
- retval = myGH->out_every > 0 && myGH->requests[vindex] &&
- GH->cctk_iteration % myGH->out_every == 0;
+ myGH = (const flexioGH *) CCTK_GHExtension (GH, "IOFlexIO");
+ retval = myGH->out_every[vindex] > 0 && myGH->requests[vindex] &&
+ GH->cctk_iteration % myGH->out_every[vindex] == 0;
if (retval)
{
/* check if variable was not already output this iteration */
@@ -254,14 +233,14 @@ int IOFlexIO_TimeFor (const cGH *GH, int vindex)
int IOFlexIO_TriggerOutput (const cGH *GH, int vindex)
{
int retval;
- flexioGH *myGH;
const char *varname;
+ const flexioGH *myGH;
DECLARE_CCTK_PARAMETERS
varname = CCTK_VarName (vindex);
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, "IOFlexIO_TriggerOutput: "
"name, index = %s, %d", varname, vindex);
@@ -273,7 +252,7 @@ int IOFlexIO_TriggerOutput (const cGH *GH, int vindex)
if (retval == 0)
{
/* register variable as having output this iteration */
- myGH = (flexioGH *) CCTK_GHExtension (GH, "IOFlexIO");
+ myGH = (const flexioGH *) CCTK_GHExtension (GH, "IOFlexIO");
myGH->out_last[vindex] = GH->cctk_iteration;
}
@@ -303,43 +282,90 @@ int IOFlexIO_TriggerOutput (const cGH *GH, int vindex)
@@*/
static void CheckSteerableParameters (const cGH *GH)
{
- int vindex, times_set;
+ int i, num_vars;
flexioGH *myGH;
- char *fullname;
- static int out_vars_lastset = -1;
+ char *fullname, *msg;
DECLARE_CCTK_PARAMETERS
/* how often to output */
myGH = (flexioGH *) CCTK_GHExtension (GH, "IOFlexIO");
- myGH->out_every = out3D_every >= 0 ? out3D_every : out_every;
+ i = myGH->out_every_default;
+ myGH->out_every_default = out_every;
+ if (myGH->out_every_default < 0)
+ {
+ myGH->out_every_default = *(const CCTK_INT *)
+ CCTK_ParameterGet ("out_every", CCTK_ImplementationThorn ("IO"), NULL);
+ }
- /* re-parse the 'out3D_vars' parameter if it was changed */
- times_set = CCTK_ParameterQueryTimesSet ("out3D_vars", CCTK_THORNSTRING);
- if (times_set != out_vars_lastset)
+ /* report if frequency changed */
+ if (myGH->out_every_default != i && ! CCTK_Equals (verbose, "none"))
{
- IOUtil_ParseVarsForOutput (GH, out3D_vars, myGH->requests);
+ if (myGH->out_every_default > 0)
+ {
+ CCTK_VInfo (CCTK_THORNSTRING, "IOFlexIO: Periodic output every %d "
+ "iterations", myGH->out_every_default);
+ }
+ else
+ {
+ CCTK_INFO ("IOFlexIO: Periodic output turned off");
+ }
+ }
+
+ /* re-parse the 'IOFlexIO::out_vars' parameter if it was changed */
+ if (strcmp (out_vars, myGH->out_vars) || myGH->out_every_default != i)
+ {
+ IOUtil_ParseVarsForOutput (GH, out_vars, myGH->requests);
/*** FIXME: IEEEIO doesn't provide a COMPLEX datatype
so we should map CCTK_COMPLEX to two REALs here.
We have to check for this already here because if an IEEEIO file
is created and nothing is written to it, it will crash
at re-opening. ***/
- for (vindex = CCTK_NumVars () - 1; vindex >= 0; vindex--)
+ num_vars = CCTK_NumVars ();
+ for (i = 0; i < num_vars; i++)
{
- if (myGH->requests[vindex] &&
- strncmp (CCTK_VarTypeName (vindex), "CCTK_VARIABLE_COMPLEX", 21))
+ if (myGH->requests[i] &&
+ strncmp (CCTK_VarTypeName (i), "CCTK_VARIABLE_COMPLEX", 21))
{
- fullname = CCTK_FullName (vindex);
+ fullname = CCTK_FullName (i);
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
"IOFlexIO output for complex variable '%s' not yet "
"supported", fullname);
free (fullname);
- IOUtil_FreeIORequest (&myGH->requests[vindex]);
+ IOUtil_FreeIORequest (&myGH->requests[i]);
+ }
+ }
+
+ if (myGH->out_every_default == i || ! CCTK_Equals (verbose, "none"))
+ {
+ msg = NULL;
+ for (i = 0; i < num_vars; i++)
+ {
+ if (myGH->requests[i])
+ {
+ fullname = CCTK_FullName (i);
+ if (! msg)
+ {
+ Util_asprintf (&msg, "IOFlexIO: 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 'out3D_vars' parameter */
- out_vars_lastset = times_set;
+ /* save the last setting of 'IOFlexIO::out_vars' parameter */
+ free (myGH->out_vars);
+ myGH->out_vars = strdup (out_vars);
}
}
diff --git a/src/Output2D.c b/src/Output2D.c
index 14d86e7..a7ba92f 100644
--- a/src/Output2D.c
+++ b/src/Output2D.c
@@ -3,20 +3,17 @@
@date Tue Jan 9 1999
@author Gabrielle Allen
@desc
- Functions to deal 2D output of GFs
+ Functions to deal with output of 2D planes of grid variables.
@enddesc
- @history
- @hauthor Thomas Radke @hdate 16 Mar 1999
- @hdesc Converted to Cactus 4.0
- @hendhistory
+ @version $Id$
@@*/
-#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cctk.h"
#include "cctk_Parameters.h"
+#include "util_String.h"
#include "ioFlexGH.h"
static const char *rcsid = "$Header$";
@@ -24,7 +21,7 @@ static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusPUGHIO_IOFlexIO_Output2D_c)
/* prototypes of routines defined in this source file */
-static int CheckOutputVar (int vindex);
+static int CheckOutputVar (int vindex, int warn);
static void CheckSteerableParameters (flexioGH *myGH);
static void SetOutputFlag (int vindex, const char *optstring, void *arg);
@@ -50,41 +47,22 @@ static void SetOutputFlag (int vindex, const char *optstring, void *arg);
int IOFlexIO_Output2DGH (const cGH *GH)
{
- int i, retval;
- flexioGH *myGH;
- const char *name;
- char *fullname;
- DECLARE_CCTK_PARAMETERS
-
-
- /* Get the GH extension for IOFlexIO */
- myGH = (flexioGH *) GH->extensions [CCTK_GHExtensionHandle ("IOFlexIO")];
-
- CheckSteerableParameters (myGH);
-
- if (myGH->out2D_every <= 0)
- return (0);
-
- /* Loop over all variables */
- for (i = retval = 0; i < CCTK_NumVars (); i++) {
-
- if (IOFlexIO_TimeFor2D (GH, i)) {
-
- name = CCTK_VarName (i);
- fullname = CCTK_FullName (i);
+ int vindex, retval;
+ const flexioGH *myGH;
- if (verbose)
- CCTK_VInfo (CCTK_THORNSTRING, "IOFlexIO_Output2DGH: "
- "fullname / name = %s / %s", fullname, name);
- if (IOFlexIO_Output2DVarAs (GH, fullname, name) == 0)
- {
- /* Register GF as having 2D output this iteration */
- myGH->out2D_last[i] = GH->cctk_iteration;
- retval++;
- }
+ retval = 0;
+ myGH = (const flexioGH *) CCTK_GHExtension (GH, "IOFlexIO");
- free (fullname);
+ /* loop over all variables */
+ for (vindex = CCTK_NumVars () - 1; vindex >= 0; vindex--)
+ {
+ if (IOFlexIO_TimeFor2D (GH, vindex) && CheckOutputVar (vindex, 0) &&
+ IOFlexIO_Write2D (GH, vindex, CCTK_VarName (vindex)) == 0)
+ {
+ /* register variable as having 2D output this iteration */
+ myGH->out2D_last[vindex] = GH->cctk_iteration;
+ retval++;
}
}
@@ -130,13 +108,15 @@ int IOFlexIO_Output2DVarAs (const cGH *GH, const char *fullname, const char *ali
vindex = CCTK_VarIndex (fullname);
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
+ {
CCTK_VInfo (CCTK_THORNSTRING, "IOFlexIO_Output2DVarAs: "
"fullname, alias, index = (%s, %s, %d)", fullname,alias,vindex);
+ }
- /* Do the 2D output */
+ /* do the 2D output */
retval = -1;
- if (CheckOutputVar (vindex) == 0)
+ if (CheckOutputVar (vindex, 1) == 0)
{
retval = IOFlexIO_Write2D (GH, vindex, alias);
}
@@ -172,37 +152,37 @@ int IOFlexIO_Output2DVarAs (const cGH *GH, const char *fullname, const char *ali
@@*/
int IOFlexIO_TimeFor2D (const cGH *GH, int vindex)
{
+ int result;
+ char *fullname;
flexioGH *myGH;
- /* Get the GH extension for IOUtil and IOFlexIO */
- myGH = (flexioGH *) GH->extensions [CCTK_GHExtensionHandle ("IOFlexIO")];
+ /* default is not do any output */
+ result = 0;
+ myGH = (flexioGH *) CCTK_GHExtension (GH, "IOFlexIO");
CheckSteerableParameters (myGH);
- /* Check if any output was requested */
- if (myGH->out2D_every <= 0)
- return (0);
-
- /* Check this GF should be output */
- if (! (CCTK_GroupTypeFromVarI (vindex) == CCTK_GF && myGH->do_out2D [vindex]
- && GH->cctk_iteration % myGH->out2D_every == 0))
- return (0);
-
- /* Check GF not already output this iteration */
- if (myGH->out2D_last [vindex] == GH->cctk_iteration)
+ /* check if this variable should be output */
+ if (myGH->out2D_every[vindex] > 0 &&
+ GH->cctk_iteration % myGH->out2D_every[vindex] == 0)
{
- char *fullname = CCTK_FullName (vindex);
-
-
- CCTK_VWarn (5, __LINE__, __FILE__, CCTK_THORNSTRING,
- "Already done 2D FlexIO output for variable '%s' in current "
- "iteration (probably via triggers)", fullname);
- free (fullname);
- return (0);
+ /* check if variable wasn't already output this iteration */
+ if (myGH->out2D_last [vindex] == GH->cctk_iteration)
+ {
+ fullname = CCTK_FullName (vindex);
+ CCTK_VWarn (5, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Already done 2D FlexIO output for variable '%s' in current "
+ "iteration (probably via triggers)", fullname);
+ free (fullname);
+ }
+ else
+ {
+ result = 1;
+ }
}
- return (1);
+ return (result);
}
@@ -234,26 +214,25 @@ int IOFlexIO_TimeFor2D (const cGH *GH, int vindex)
int IOFlexIO_TriggerOutput2D (const cGH *GH, int vindex)
{
int retval;
- flexioGH *myGH;
const char *varname;
+ const flexioGH *myGH;
DECLARE_CCTK_PARAMETERS
varname = CCTK_VarName (vindex);
- /* get the handle for IOFlexIO extensions */
- myGH = (flexioGH *) GH->extensions [CCTK_GHExtensionHandle ("IOFlexIO")];
-
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
+ {
CCTK_VInfo (CCTK_THORNSTRING, "IOFlexIO_TriggerOutput2D: "
"name, index = (%s, %d)", varname, vindex);
+ }
- /* Do the 2D output */
+ /* do the 2D output */
retval = IOFlexIO_Write2D (GH, vindex, varname);
-
if (retval == 0)
{
- /* Register GF as having 2D output this iteration */
+ /* register variable as having 2D output this iteration */
+ myGH = (const flexioGH *) CCTK_GHExtension (GH, "IOFlexIO");
myGH->out2D_last [vindex] = GH->cctk_iteration;
}
@@ -265,45 +244,91 @@ int IOFlexIO_TriggerOutput2D (const cGH *GH, int vindex)
/* check if steerable parameters have changed */
static void CheckSteerableParameters (flexioGH *myGH)
{
- int times_set;
- static int out2D_vars_lastset = -1;
+ int i, num_vars;
+ char *fullname, *msg;
DECLARE_CCTK_PARAMETERS
- /* How often to output */
- myGH->out2D_every = out2D_every >= 0 ? out2D_every : out_every;
+ /* how often to output */
+ i = myGH->out2D_every_default;
+ myGH->out2D_every_default = out2D_every;
+ if (myGH->out2D_every_default < 0)
+ {
+ myGH->out2D_every_default = *(const CCTK_INT *)
+ CCTK_ParameterGet ("out_every", CCTK_ImplementationThorn ("IO"), NULL);
+ }
- /* re-parse the 'out2D_vars' parameter if it was changed */
- times_set = CCTK_ParameterQueryTimesSet ("out2D_vars", CCTK_THORNSTRING);
- if (times_set != out2D_vars_lastset)
+ /* report if frequency changed */
+ if (myGH->out2D_every_default != i && ! CCTK_Equals (verbose, "none"))
{
- memset (myGH->do_out2D, 0, CCTK_NumVars ());
- CCTK_TraverseString (out2D_vars, SetOutputFlag, myGH->do_out2D,
+ if (myGH->out2D_every_default > 0)
+ {
+ CCTK_VInfo (CCTK_THORNSTRING, "IOFlexIO_2D: Periodic output every %d "
+ "iterations", myGH->out2D_every_default);
+ }
+ else
+ {
+ CCTK_INFO ("IOFlexIO_2D: Periodic output turned off");
+ }
+ }
+
+ /* re-parse the 'IOFlexIO::out2D_vars' parameter if it was changed */
+ if (strcmp (out2D_vars, myGH->out2D_vars) || myGH->out2D_every_default != i)
+ {
+ num_vars = CCTK_NumVars ();
+ memset (myGH->out2D_every, 0, num_vars);
+ CCTK_TraverseString (out2D_vars, SetOutputFlag, myGH->out2D_every,
CCTK_GROUP_OR_VAR);
- /* Save the last setting of 'out2D_vars' parameter */
- out2D_vars_lastset = times_set;
+ if (myGH->out2D_every_default == i || ! CCTK_Equals (verbose, "none"))
+ {
+ msg = NULL;
+ for (i = 0; i < num_vars; i++)
+ {
+ if (myGH->out2D_every[i])
+ {
+ fullname = CCTK_FullName (i);
+ if (! msg)
+ {
+ Util_asprintf (&msg, "IOFlexIO_2D: 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 'IOFlexIO::out2D_vars' parameter */
+ free (myGH->out2D_vars);
+ myGH->out2D_vars = strdup (out2D_vars);
}
}
/* check if this variable can be output (static conditions) */
-static int CheckOutputVar (int vindex)
+static int CheckOutputVar (int vindex, int warn)
{
int retval;
char *fullname;
- retval = 0;
-
/* check the group dimension */
- if (CCTK_GroupDimFromVarI (vindex) != 3)
+ retval = CCTK_GroupDimFromVarI (vindex) == 3 ? 0 : -1;
+ if (retval && warn)
{
fullname = CCTK_FullName (vindex);
CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
"No IOFlexIO 2D output for '%s' (dim != 3)", fullname);
free (fullname);
- retval = -1;
}
return (retval);
@@ -314,13 +339,13 @@ static int CheckOutputVar (int vindex)
for the given variable */
static void SetOutputFlag (int vindex, const char *optstring, void *arg)
{
- char *flags = (char *) arg;
+ int *out2D_every = (int *) arg;
- /* Check the variable type */
- if (CheckOutputVar (vindex) == 0)
+ /* check the variable type */
+ if (CheckOutputVar (vindex, 1) == 0)
{
- flags[vindex] = 1;
+ out2D_every[vindex] = 1;
}
if (optstring)
diff --git a/src/RecoverGH.c b/src/RecoverGH.c
index 53befd0..3cbeeab 100644
--- a/src/RecoverGH.c
+++ b/src/RecoverGH.c
@@ -142,7 +142,7 @@ int IOFlexIO_Recover (cGH *GH, const char *basefilename, int called_from)
/* Recover GH extensions */
if (called_from == CP_RECOVER_DATA)
{
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_INFO ("Recovering GH extensions");
}
@@ -152,7 +152,7 @@ int IOFlexIO_Recover (cGH *GH, const char *basefilename, int called_from)
if (! result)
{
/* Recover variables */
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, "Recovering %schunked data with ioproc %d, "
"ioproc_every %d", file.unchunked ? "un" : "", file.ioproc,
@@ -164,7 +164,7 @@ int IOFlexIO_Recover (cGH *GH, const char *basefilename, int called_from)
/* Close the file and remove it if requested by the user */
if (CCTK_MyProc (GH) == file.ioproc)
{
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
if (called_from == CP_RECOVER_DATA)
{
@@ -180,7 +180,7 @@ int IOFlexIO_Recover (cGH *GH, const char *basefilename, int called_from)
if (called_from == CP_RECOVER_DATA && recover_and_remove)
{
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, "Removing checkpoint file '%s' after "
"successful recovery", file.filename);
@@ -288,7 +288,7 @@ static int OpenFile (cGH *GH, const char *basefilename, int called_from,
if (myproc == 0)
{
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, "Opening file '%s'", file->filename);
}
@@ -307,7 +307,7 @@ static int OpenFile (cGH *GH, const char *basefilename, int called_from,
file->unchunked);
strcat (file->filename, ".ieee");
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, "Trying now file '%s'...",file->filename);
}
@@ -380,7 +380,7 @@ static int OpenFile (cGH *GH, const char *basefilename, int called_from,
*/
if ((file->ioproc_every == nprocs && nprocs > 1) || file->unchunked)
{
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, "Recovering from one %schunked file",
file->unchunked ? "un":"");
@@ -398,7 +398,7 @@ static int OpenFile (cGH *GH, const char *basefilename, int called_from,
}
else
{
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, "Recovering from %d chunked files",
nprocs / file->ioproc_every +
@@ -446,7 +446,7 @@ static int OpenFile (cGH *GH, const char *basefilename, int called_from,
/* Open chunked files on other IO processors */
if (myproc == file->ioproc && myproc != 0)
{
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, "Opening chunked file '%s' on "
"processor %d", file->filename, myproc);
@@ -571,13 +571,13 @@ static int RecoverParameters (fileinfo_t *file)
myproc = CCTK_MyProc (NULL);
if (myproc == 0)
{
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, "Recovering parameters from checkpoint "
"file '%s'", file->filename);
}
- /* Get the parameters attribute. */
+ /* get the parameters attribute. */
i = IOreadAttributeInfo (file->fid, GLOBAL_PARAMETERS, &atype, &asize);
if (i >= 0 && atype == FLEXIO_CHAR && asize > 0)
{
diff --git a/src/RestoreFile.c b/src/RestoreFile.c
index 6dbfc02..a3f2213 100644
--- a/src/RestoreFile.c
+++ b/src/RestoreFile.c
@@ -117,7 +117,7 @@ int IOFlexIOi_RecoverVariables (cGH *GH, fileinfo_t *file)
{
/* get the number of sets */
nDatasets = IOnDatasets (file->fid);
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, " Input file has %d datasets", nDatasets);
}
@@ -166,7 +166,7 @@ int IOFlexIOi_RecoverVariables (cGH *GH, fileinfo_t *file)
check whether the user wants to have this variable restored */
if (ioUtilGH->do_inVars && ! ioUtilGH->do_inVars[vindex])
{
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
fullname = CCTK_FullName (vindex);
CCTK_VInfo (CCTK_THORNSTRING, "Ignoring variable '%s' for file "
@@ -177,7 +177,7 @@ int IOFlexIOi_RecoverVariables (cGH *GH, fileinfo_t *file)
}
/* read in the data */
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
fullname = CCTK_FullName (vindex);
CCTK_VInfo (CCTK_THORNSTRING, " dataset %d: %s (timelevel %d)",
diff --git a/src/Startup.c b/src/Startup.c
index ecddd20..e75b1d4 100644
--- a/src/Startup.c
+++ b/src/Startup.c
@@ -112,7 +112,7 @@ int IOFlexIO_TerminateGH (const cGH *GH)
while (current)
{
IEEEfiles_2D = (IOFile *) current->data;
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, "Closing 2D IEEEIO output files "
"for variable alias '%s'", current->name);
@@ -131,7 +131,7 @@ int IOFlexIO_TerminateGH (const cGH *GH)
IEEEfile = (IEEEfile_t *) current->data;
if (IEEEfile->iofile)
{
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, "Closing IEEEIO output file '%s'",
IEEEfile->filename);
@@ -205,9 +205,10 @@ int IOFlexIO_TerminateGH (const cGH *GH)
@@*/
static void *SetupGH (tFleshConfig *config, int conv_level, cGH *GH)
{
- int i, numvars, maxdim;
+ int i, numvars;
flexioGH *myGH;
const ioGH *ioUtilGH;
+ const char *default_out_dir;
const char *timer_names[4] = {"IOFlexIO time to dump parameters",
"IOFlexIO time to dump datasets",
"IOFlexIO total time to checkpoint",
@@ -242,72 +243,54 @@ static void *SetupGH (tFleshConfig *config, int conv_level, cGH *GH)
numvars = CCTK_NumVars ();
myGH = (flexioGH *) malloc (sizeof (flexioGH));
myGH->requests = (ioRequest **) calloc (numvars, sizeof (ioRequest *));
- myGH->do_out2D = (char *) malloc (numvars * sizeof (char));
+ myGH->out_every = (int *) malloc (numvars * sizeof (int));
+ myGH->out2D_every = (int *) malloc (numvars * sizeof (int));
myGH->out_last = (int *) malloc (numvars * sizeof (int));
myGH->out2D_last = (int *) malloc (numvars * sizeof (int));
- maxdim = CCTK_MaxDim();
- myGH->sp2xyz = (int **) malloc(maxdim * sizeof (int *));
- for (i = 0; i < maxdim; i++)
- {
- myGH->sp2xyz[i] = (int *) malloc (3 * sizeof (int ));
- }
-
- /* get the handle for IOUtil extensions */
- ioUtilGH = (const ioGH *) CCTK_GHExtension (GH, "IO");
-
- /* check whether "outdir2D" and/or "outdir3D" were set.
- If so take these dirs otherwise default to "IO::outdir" */
- if (*outdir2D)
- {
- myGH->outdir2D = strdup (outdir2D);
- }
- else
- {
- myGH->outdir2D = CCTK_ParameterValString ("outdir",
- CCTK_ImplementationThorn ("IO"));
- }
+ myGH->out_vars = strdup ("");
+ myGH->out_every_default = out_every - 1;
+ myGH->out2D_vars = strdup ("");
+ myGH->out2D_every_default = out2D_every - 1;
- if (*outdir3D)
- {
- myGH->outdir = strdup (outdir3D);
- }
- else
- {
- myGH->outdir = CCTK_ParameterValString ("outdir",
- CCTK_ImplementationThorn ("IO"));
- }
+ /* get the names of output directories */
+ default_out_dir = *(const char **)
+ CCTK_ParameterGet ("out_dir",
+ CCTK_ImplementationThorn ("IO"), NULL);
+ myGH->out2D_dir = strdup (*out2D_dir ? out2D_dir : default_out_dir);
+ myGH->out_dir = strdup (*out_dir ? out_dir : default_out_dir);
/* create the output directories */
- i = IOUtil_CreateDirectory (GH, myGH->outdir2D,
- ! CCTK_Equals (out3D_mode, "onefile"),
+ ioUtilGH = (const ioGH *) CCTK_GHExtension (GH, "IO");
+ i = IOUtil_CreateDirectory (GH, myGH->out2D_dir,
+ ! CCTK_Equals (out_mode, "onefile"),
ioUtilGH->ioproc);
if (i < 0)
{
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
"IOFlexIO_InitGH: problem creating IOFlexIO 2D output"
- " directory '%s'", myGH->outdir2D);
+ " directory '%s'", myGH->out2D_dir);
}
- else if (i > 0 && CCTK_Equals (newverbose, "full"))
+ else if (i > 0 && CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING,
"IOFlexIO_InitGH: 2D IOFlexIO output directory '%s' "
- "already exists", myGH->outdir2D);
+ "already exists", myGH->out2D_dir);
}
- i = IOUtil_CreateDirectory (GH, myGH->outdir,
- ! CCTK_Equals (out3D_mode, "onefile"),
+ i = IOUtil_CreateDirectory (GH, myGH->out_dir,
+ ! CCTK_Equals (out_mode, "onefile"),
ioUtilGH->ioproc);
if (i < 0)
{
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
"IOFlexIO_InitGH: Problem creating IOFlexIO output"
- " directory '%s'", myGH->outdir);
+ " directory '%s'", myGH->out_dir);
}
- else if (i > 0 && CCTK_Equals (newverbose, "full"))
+ else if (i > 0 && CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING,
"IOFlexIO_InitGH: IOFlexIO output directory '%s' "
- "already exists", myGH->outdir);
+ "already exists", myGH->out_dir);
}
for (i = 0; i < numvars; i++)
diff --git a/src/Write.c b/src/Write.c
index 44ace87..90ae21f 100644
--- a/src/Write.c
+++ b/src/Write.c
@@ -84,7 +84,7 @@ int IOFlexIO_Write (const cGH *GH, int vindex, const char *alias)
return (-1);
}
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, "IOFlexIO output of variable '%s', "
"alias '%s'", CCTK_VarName (vindex), alias);
@@ -99,7 +99,7 @@ int IOFlexIO_Write (const cGH *GH, int vindex, const char *alias)
{
if (is_new_file || reuse_filehandles)
{
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, "%s IEEEIO output file '%s'",
is_new_file ? "Opening" : "Resuming", file->filename);
@@ -177,25 +177,25 @@ int IOFlexIO_Write (const cGH *GH, int vindex, const char *alias)
if (is_new_file)
{
IOFlexIOi_DumpGHExtensions (GH, file->iofile);
- if (strcmp (out3D_parameters, "no"))
+ if (! CCTK_Equals (out_save_parameters, "no"))
{
- IOFlexIOi_DumpParameters (GH, strcmp (out3D_parameters, "all") == 0,
+ IOFlexIOi_DumpParameters (GH, CCTK_Equals (out_save_parameters, "all"),
file->iofile);
}
}
/* close the file */
- if (out3D_septimefiles || reuse_filehandles)
+ if (out_timesteps_per_file > 0 || reuse_filehandles)
{
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, "%s IEEEIO output file '%s'",
- out3D_septimefiles ? "Closing" : "Pausing",
+ out_timesteps_per_file > 0 ? "Closing" : "Pausing",
file->filename);
}
IEEEbufferOff (file->iofile);
- if (out3D_septimefiles)
+ if (out_timesteps_per_file > 0)
{
FLEXIO_ERROR (IOclose (file->iofile));
}
@@ -205,7 +205,7 @@ int IOFlexIO_Write (const cGH *GH, int vindex, const char *alias)
}
}
}
- if (out3D_septimefiles)
+ if (out_timesteps_per_file > 0)
{
free (file->filename);
free (file);
@@ -248,7 +248,7 @@ static IEEEfile_t *OpenFile (const cGH *GH, const char *alias, int *is_new_file)
nprocs = CCTK_nProcs (GH);
myproc = CCTK_MyProc (GH);
- if (out3D_septimefiles)
+ if (out_timesteps_per_file > 0)
{
tmp = extra;
sprintf (extra, "%s.time_%7.3f", extra, GH->cctk_time);
@@ -278,18 +278,18 @@ static IEEEfile_t *OpenFile (const cGH *GH, const char *alias, int *is_new_file)
sprintf (extra, "%s.file_%d", extra, myproc / ioUtilGH->ioproc_every);
/* if necessary create the output directory */
- outputdir = (char *) malloc (strlen (myGH->outdir) + strlen (alias) + 5);
- sprintf (outputdir, "%s/%s_3d", myGH->outdir, alias);
+ outputdir = (char *) malloc (strlen (myGH->out_dir) + strlen (alias) + 5);
+ sprintf (outputdir, "%s/%s_3d", myGH->out_dir, alias);
result = IOUtil_CreateDirectory (GH, outputdir,
- ! CCTK_Equals (out3D_mode, "onefile"),
+ ! CCTK_Equals (out_mode, "onefile"),
ioUtilGH->ioproc);
if (result < 0)
{
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
"Problem creating IOFlexIO output directory '%s'", outputdir);
}
- else if (result > 0 && CCTK_Equals (newverbose, "full"))
+ else if (result > 0 && CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING,
"IOFlexIO output directory '%s' already exists", outputdir);
@@ -311,14 +311,14 @@ static IEEEfile_t *OpenFile (const cGH *GH, const char *alias, int *is_new_file)
file = (IEEEfile_t *) malloc (sizeof (IEEEfile_t));
- file->filename = (char *) malloc (strlen (myGH->outdir) + strlen (extradir) +
+ file->filename = (char *) malloc (strlen (myGH->out_dir) + strlen (extradir) +
strlen (alias) + strlen (extra) +
strlen (GH->identity) + 10);
- sprintf (file->filename, "%s/%s%s_3d%s%s.ieee", myGH->outdir,
+ sprintf (file->filename, "%s/%s%s_3d%s%s.ieee", myGH->out_dir,
extradir, alias, extra, GH->identity);
/* no need to store file info if used only once */
- if (! out3D_septimefiles)
+ if (out_timesteps_per_file < 0)
{
if (myproc == ioUtilGH->ioproc)
{
diff --git a/src/Write2D.c b/src/Write2D.c
index 1c3bd7f..51416b7 100644
--- a/src/Write2D.c
+++ b/src/Write2D.c
@@ -137,7 +137,7 @@ int IOFlexIO_Write2D (const cGH *GH, int vindex, const char *alias)
IEEEfile_2D = (IOFile *) malloc (3 * sizeof (IOFile));
- fname = (char *) malloc (strlen (myGH->outdir2D) + strlen (alias) +
+ fname = (char *) malloc (strlen (myGH->out2D_dir) + strlen (alias) +
strlen (GH->identity) + 20);
/* Open/Create files */
@@ -148,7 +148,7 @@ int IOFlexIO_Write2D (const cGH *GH, int vindex, const char *alias)
const char *extensions[3] = {"yz", "xz", "xy"};
- sprintf (fname, "%s/%s_2d_%s%s.ieee", myGH->outdir2D, alias,
+ sprintf (fname, "%s/%s_2d_%s%s.ieee", myGH->out2D_dir, alias,
extensions[dir], GH->identity);
/* if restart from recovery, try to open an exisiting file ... */
@@ -207,7 +207,7 @@ int IOFlexIO_Write2D (const cGH *GH, int vindex, const char *alias)
/* resume the files (reopen descriptors)
This allows descriptor reuse without requiring expensive destruction
and reallocation of the associated data structures */
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, "Resuming 2D output files for variable "
"'%s'", CCTK_VarName (vindex));
@@ -303,7 +303,7 @@ int IOFlexIO_Write2D (const cGH *GH, int vindex, const char *alias)
if (reuse_filehandles && myproc == 0)
{
/* pause the files (close system descriptors) */
- if (verbose)
+ if (CCTK_Equals (verbose, "full"))
{
CCTK_VInfo (CCTK_THORNSTRING, "Pausing 2D output files for variable '%s'",
CCTK_VarName (vindex));
diff --git a/src/ioFlexGH.h b/src/ioFlexGH.h
index 88d550d..1fce020 100644
--- a/src/ioFlexGH.h
+++ b/src/ioFlexGH.h
@@ -2,7 +2,7 @@
@header IOFlexIOGH.h
@date Tue 9th Jan 1999
@author Gabrielle Allen
- @desc
+ @desc
The extensions to the GH structure from IOFlexIO.
@enddesc
@version $Header$
@@ -89,7 +89,7 @@ typedef struct
/* structure holding necessary information about a recovery file */
typedef struct
-{
+{
int is_IEEEIO_file; /* flag indicating valid file info */
IOFile fid; /* IEEEIO file handle */
char filename[1024]; /* complete file name for recovery */
@@ -106,23 +106,26 @@ typedef struct
/* IOFlexIO GH extension structure */
typedef struct IOFlexIOGH
{
- /* flags indicating 2D output for var [i] */
- char *do_out2D;
+ /* default number of times to output */
+ int out_every_default, out2D_every_default;
+
+ /* number of times to output for each variable */
+ int *out_every, *out2D_every;
+
+ /* the last iteration output for each variable */
+ int *out_last, *out2D_last;
+
+ /* list of variables to output */
+ char *out_vars, *out2D_vars;
/* I/O request descriptions for all CCTK variables */
ioRequest **requests;
- /* how often to output */
- int out2D_every, out_every;
-
/* directory in which to output */
- char *outdir2D, *outdir;
-
- /* the last iteration output */
- int *out2D_last, *out_last;
+ char *out_dir, *out2D_dir;
/* filename database for opened files */
- pNamedData *fileList_2D, *fileList;
+ pNamedData *fileList, *fileList_2D;
/* timer array for checkpointing/recovery */
int timers[4];
diff --git a/test/checkpoint.parfile b/test/checkpoint.parfile
index 370220e..99fe0fd 100644
--- a/test/checkpoint.parfile
+++ b/test/checkpoint.parfile
@@ -17,18 +17,18 @@ ActiveThorns = "Time PUGH PUGHReduce PUGHSlab WavetoyC IDScalarWaveC CartGrid3D
# Output directory must be the basename of the recovery parameter file's
# filename
-IO::outdir = "test_recover"
+IO::out_dir = "test_recover"
# Checkpoint initial data into a single unchunked checkpoint file
# with basename 'WavetoyID' and place it into the current directory
IO::checkpoint_ID = "yes"
-IO::out3D_unchunked = "yes"
-IO::out3D_mode = "onefile"
+IO::out_unchunked = "yes"
+IO::out_mode = "onefile"
IO::checkpoint_ID_file = "WavetoyID.chkpt"
IO::checkpoint_dir = "."
# Give some verbose output while checkpointing
-IO::verbose = "yes"
+IO::verbose = "standard"
# Say that the checkpoint file should be created by the IOFlexIO method
IOFlexIO::checkpoint = "yes"
@@ -62,3 +62,6 @@ IOASCII::out1D_d = "no"
IOASCII::out1D_vars = "wavetoy::phi"
IO::out_fileinfo = "none"
+
+# do not use the new scheme for names of output files
+IO::new_filename_scheme = "no" \ No newline at end of file
diff --git a/test/test_recover.par b/test/test_recover.par
index 01f03dc..bd1f24b 100644
--- a/test/test_recover.par
+++ b/test/test_recover.par
@@ -23,7 +23,7 @@ IO::recover = "manual"
IO::recover_file = "WavetoyID.chkpt.it_0"
# ... to be found in directory ...
-IO::recovery_dir = "../../../arrangements/CactusPUGHIO/IOFlexIO/test/"
+IO::recover_dir = "../../../arrangements/CactusPUGHIO/IOFlexIO/test/"
# Note that this parameter is restored to "yes" during parameter recovery.
# Since we don't need to checkpoint twice it is explicitely disabled here.
@@ -32,3 +32,6 @@ IO::checkpoint_ID = "no"
# disable output of file information (parameter filename, creation date)
# because this could cause diffs when running the testsuite
IO::out_fileinfo = "none"
+
+# do not use the new scheme for names of output files
+IO::new_filename_scheme = "no"