aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README20
-rw-r--r--interface.ccl4
-rw-r--r--param.ccl174
-rw-r--r--schedule.ccl12
-rw-r--r--src/CheckpointRecovery.c188
-rw-r--r--src/GHExtension.c302
-rw-r--r--src/Startup.c48
-rw-r--r--src/ioGH.h54
-rw-r--r--src/make.code.defn1
9 files changed, 803 insertions, 0 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..5889733
--- /dev/null
+++ b/README
@@ -0,0 +1,20 @@
+Cactus Code Thorn IOUtil
+Authors : Thomas Radke
+Managed by : Thomas Radke <tra@aei-potsdam.mpg.de>
+Version : 1.0
+CVS info : $Header$
+--------------------------------------------------------------------------
+
+1. Purpose of the thorn
+
+This thorn just provides the parameters for IO.
+
+2. Dependencies of the thorn
+
+This thorn requires no other thorns.
+
+3. Thorn distribution
+
+This thorn is available to public.
+
+4. Additional information
diff --git a/interface.ccl b/interface.ccl
new file mode 100644
index 0000000..9db69b8
--- /dev/null
+++ b/interface.ccl
@@ -0,0 +1,4 @@
+# Interface definitions for thorn IOUtil
+
+implements: IO
+inherits: Cactus
diff --git a/param.ccl b/param.ccl
new file mode 100644
index 0000000..4212c20
--- /dev/null
+++ b/param.ccl
@@ -0,0 +1,174 @@
+# Parameter definitions for thorn IOUtil
+
+#############################################################################
+### import grid parameters
+#############################################################################
+friend: grid
+
+EXTEND KEYWORD symmetry ""
+{
+}
+
+#############################################################################
+### declare IOUtil parameters
+### These are declared protected so that they can be seen by other IO thorns.
+#############################################################################
+protected:
+
+####################
+# Output directories
+####################
+STRING IO_outdir "Name of IO output directory"
+{
+} "."
+STRING IO_outdir0D "Name of IO 0D output directory, overrides IO_outdir"
+{
+} "IO_outdir"
+STRING IO_outdir1D "Name of IO 1D output directory, overrides IO_outdir"
+{
+} "IO_outdir"
+STRING IO_outdir2D "Name of IO 2D output directory, overrides IO_outdir"
+{
+} "IO_outdir"
+STRING IO_outdir3D "Name of IO 3D output directory, overrides IO_outdir"
+{
+} "IO_outdir"
+
+
+########################
+# How often to do output
+########################
+INTEGER IO_every "How often to do IO output"
+{
+ -1:* ::
+} -1
+INTEGER IO_0Devery "How often to do 0D output, overrides IO_every"
+{
+ -1:* ::
+} -1
+INTEGER IO_1Devery "How often to do 1D output, overrides IO_every"
+{
+ -1:* ::
+} -1
+INTEGER IO_2Devery "How often to do 2D output, overrides IO_every"
+{
+ -1:* ::
+} -1
+INTEGER IO_3Devery "How often to do 3D output, overrides IO_every"
+{
+ -1:* ::
+} -1
+
+
+################
+# various things
+################
+LOGICAL IO_verbose "Give extended screen output in IO?"
+{
+} "no"
+LOGICAL IO_datestamp "Write date as attribute to IO 3D output file?"
+{
+} "yes"
+LOGICAL IO_parameters "Write parameters to IO 3D output file?"
+{
+} "yes"
+LOGICAL IO_structures "Write structures to IO 3D output file?"
+{
+} "yes"
+
+
+#######################
+# Specific to 1D output
+# Choosing what output to do
+#######################
+LOGICAL Dox_1D "Do 1D output in the x-direction"
+{
+} "yes"
+LOGICAL Doy_1D "Do 1D output in the y-direction"
+{
+} "yes"
+LOGICAL Doz_1D "Do 1D output in the z-direction"
+{
+} "yes"
+LOGICAL Dod_1D "Do 1D output in the diagonal-direction"
+{
+} "yes"
+
+
+#######################
+# Specific to 3D output
+#######################
+KEYWORD iomode "Which mode for 3D IO"
+{
+ "proc" :: "every processor writes its share of data into a separate file"
+ "np" :: "data is collected and written by every N'th processor into a separate file, where N is specified by the parameter ioproc_every"
+ "onefile" :: "all output is written into a single file by processor 0"
+} "proc"
+
+INTEGER ioproc_every "Do IO on every N processors."
+{
+ 1:* :: "Must be a positive integer"
+} 8
+LOGICAL onefileperslice "Write one file per time slice, as opposed to all data in one file"
+{
+} "no"
+LOGICAL unchunked "Don't write data in chunks."
+{
+} "no"
+
+
+##############################################
+# Downsampling parameters (only for 3D output)
+##############################################
+INTEGER downsample_x "Factor by which to downsample output in x direction. Point (0,0,0) is always included."
+{
+ 1:* :: "Must be a positive integer"
+} 1
+INTEGER downsample_y "Factor by which to downsample output in y direction. Point (0,0,0) is always included."
+{
+ 1:* :: "Must be a positive integer"
+} 1
+INTEGER downsample_z "Factor by which to downsample output in z direction. Point (0,0,0) is always included."
+{
+ 1:* :: "Must be a positive integer"
+} 1
+LOGICAL out_single "Output 3D data in single precision ? This parameter is ignored for Cactus compiled with SINGLE_PRECISION."
+{
+} "no"
+
+
+###################################
+# Checkpointing/recovery parameters
+###################################
+LOGICAL checkpoint_ID "Checkpoint initial data ?"
+{
+} "no"
+LOGICAL checkpoint_keep_all "Keep all checkpoint files ?"
+{
+} "no"
+LOGICAL recover "Recover from a checkpoint file ?"
+{
+} "no"
+INTEGER checkpoint_every "Checkpoint every x iterations"
+{
+ -1:* :: "negative values disable checkpointing"
+} -1
+INTEGER checkpoint_keep "How many checkpoint files to keep"
+{
+ 1:* :: "1 overwrites the latest checkpoint file"
+} 1
+STRING checkpoint_file "File name for regular checkpoint"
+{
+} "checkpoint"
+STRING checkpoint_ID_file "File name for initial data checkpoint"
+{
+} "checkpointID"
+STRING recover_file "File name of recovery file"
+{
+} "checkpoint"
+STRING checkpoint_dir "Output directory for checkpoint files"
+{
+} "."
+STRING recovery_dir "Directory to look for the recovery file"
+{
+} "."
diff --git a/schedule.ccl b/schedule.ccl
new file mode 100644
index 0000000..55f4fd2
--- /dev/null
+++ b/schedule.ccl
@@ -0,0 +1,12 @@
+# Schedule definitions for thorn IOUtil
+
+schedule IOUtil_Startup at STARTUP
+{
+ LANG:C
+} "IOUtil startup routine"
+
+if (recover) {
+ schedule IOUtil_RecoverGH at CCTK_RECOVER {
+ LANG:C
+ } "Checkpoint recovery routine"
+}
diff --git a/src/CheckpointRecovery.c b/src/CheckpointRecovery.c
new file mode 100644
index 0000000..12e1e5c
--- /dev/null
+++ b/src/CheckpointRecovery.c
@@ -0,0 +1,188 @@
+ /*@@
+ @file CheckpointRecovery.c
+ @date Jun 04 1999
+ @author Thomas Radke
+ @desc
+ Utility routines for checkpointing/recovery and the filereader
+ The actual work is done by the IO thorns.
+ @@*/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "cctk.h"
+#include "flesh.h"
+#include "declare_parameters.h"
+#include "Groups.h"
+#include "Comm.h"
+#include "GHExtensions.h"
+#include "ioGH.h"
+
+
+
+ /*@@
+ @routine IOUtil_PrepareFilename
+ @date Fri Aug 21 14:54:38 1998
+ @author Gerd Lanfermann
+ @desc
+ This routine prepares the filenames for the checkpoint/recovery
+ and filereader files, paying attention to the different types:
+ * it returns the full filename (directory+filename)
+
+ * it prepends "Ln_" level indicators to the filename
+ and "low_"/"med_" for convergence levels > 1
+
+ * for checkpoint files it prepends the iteration number as "it_%d"
+
+ * for chunked files it prepends the file number as "file_%d"
+
+ @enddesc
+ @calls
+ @calledby FlexIO_DumpGH HDF5IO_DumpGH
+ @var GH
+ @vdesc Pointer to CCTK grid hierarchy
+ @vtype cGH
+ @vio in
+ @endvar
+ @var basename
+ @vdesc basename of the file(s) to recover from
+ @vtype const char *
+ @vio in
+ @endvar
+ @var fname
+ @vdesc the resulting filename
+ @vtype char *
+ @vio out
+ @endvar
+ @var called_from
+ @vdesc indicates the caller function:
+ * either Filereader (FILEREADER_DATA)
+ * or IOUtil_RecoverGH() (CP_RECOVER_DATA)
+ @vtype int
+ @vio in
+ @endvar
+ @var file_ioproc
+ @vdesc the IO processor number (for chunked files)
+ @vtype int
+ @vio in
+ @endvar
+ @var file_unchunked
+ @vdesc flag to indicate whether file mode is unchunked or not
+ @vtype int
+ @vio in
+ @endvar
+ @history
+ @hdate Nov 4 1998 @hauthor Gabrielle Allen
+ @hdesc A file_* in the name indicates it needs recombining
+ @hdate Apr 14 1999 @hauthor Thomas Radke
+ @hdesc Removed code for expanding "basedir" and "nameofparfile"
+ @hdate May 06 1999 @hauthor Thomas Radke
+ @hdesc Added parameter unchunked to be independent of current chunking mode
+ for recovery
+ @endhistory
+
+@@*/
+
+void IOUtil_PrepareFilename (cGH *GH, const char *basename, char *fname,
+ int called_from, int file_ioproc, int file_unchunked)
+{
+ DECLARE_PARAMETERS
+
+ /* get the right parameters */
+ switch (called_from) {
+ case CP_INITIAL_DATA:
+ sprintf (fname, "%s/%s", checkpoint_dir, checkpoint_ID_file); break;
+ case CP_EVOLUTION_DATA:
+ sprintf (fname, "%s/%s", checkpoint_dir, checkpoint_file); break;
+ case CP_RECOVER_DATA:
+ sprintf (fname, "%s/%s", recovery_dir, recover_file); break;
+ case FILEREADER_DATA:
+ strcpy (fname, basename); break;
+
+ default:
+ CCTK_WARN (2, "Unknown calling mode in IO_PrepareFilename().");
+ break;
+ }
+
+ /* add refinement factor and convergence level (med/low) inbetween: */
+ if (GH->levfac > 1)
+ sprintf (fname, "%sL%d_", fname, GH->levfac);
+ if (GH->convlevel > 1)
+ strcat (fname, GH->convlevel == 2 ? "med_" : "low_");
+
+ /* If checkpoint filename, merge in the iteration number
+ and for chunked files also the file number */
+ if (called_from == CP_INITIAL_DATA || called_from == CP_EVOLUTION_DATA)
+ sprintf (fname, "%s.it_%d", fname, (int) GH->iteration);
+
+ /* If not one unchunked file give a file number */
+ if (! file_unchunked)
+ sprintf (fname, "%s.file_%d", fname, file_ioproc);
+
+}
+
+
+ /*@@
+ @routine IOUtil_RecoverFromFile
+ @date Jun 14 1999
+ @author Thomas Radke
+ @desc
+ Recover from a given file.
+ This routine loops through all XXX_RecoverGH routines
+ registered by IO thorns.
+ @enddesc
+ @var GH
+ @vdesc Pointer to CCTK grid hierarchy
+ @vtype cGH
+ @vio in
+ @endvar
+ @var basename
+ @vdesc basename of the file(s) to recover from
+ @vtype const char *
+ @vio in
+ @endvar
+ @var called_from
+ @vdesc indicates the caller function:
+ * either Filereader (FILEREADER_DATA)
+ * or IOUtil_RecoverGH() (CP_RECOVER_DATA)
+ @vtype int
+ @vio in
+ @endvar
+
+ @history
+ @endhistory
+ @@*/
+void IOUtil_RecoverFromFile (cGH *GH, const char *basename, int called_from)
+{
+ /*** FIXME: loop through registered routines here !!! ***/
+#ifdef CACTUSBASE_FLEXIO
+ if (FlexIO_RecoverGH (GH, basename, called_from) < 0)
+#endif
+#ifdef CACTUSBASE_HDF5IO
+ if (HDF5IO_RecoverGH (GH, basename, called_from) < 0)
+#endif
+ CCTK_WARN (1, "Could not recover");
+}
+
+
+ /*@@
+ @routine IOUtil_RecoverGH
+ @date Jun 14 1999
+ @author Thomas Radke
+ @desc
+ The rfr-registered recovery routine.
+ Just calls IOUtil_RecoverFromFile() with called_from == CP_RECOVER_DATA.
+ @enddesc
+ @var GH
+ @vdesc Pointer to CCTK grid hierarchy
+ @vtype cGH
+ @vio in
+ @endvar
+ @history
+ @endhistory
+ @@*/
+void IOUtil_RecoverGH (cGH *GH)
+{
+ IOUtil_RecoverFromFile (GH, NULL, CP_RECOVER_DATA);
+}
diff --git a/src/GHExtension.c b/src/GHExtension.c
new file mode 100644
index 0000000..5bca77d
--- /dev/null
+++ b/src/GHExtension.c
@@ -0,0 +1,302 @@
+ /*@@
+ @file GHExtension.c
+ @date Tue 9th Feb 1999
+ @author Gabrielle Allen
+ @desc
+ IOUtil GH extension stuff.
+ @enddesc
+ @history
+ @hauthor Thomas Radke @hdate 16 Mar 1999
+ @hdesc Added parameters for 2D and 3D output
+ @hauthor Thomas Radke @hdate 01 Apr 1999
+ @hdesc check parameter symmetry instead of grid in Automatic1DLines()
+ @endhistory
+ @@*/
+
+/*#define DEBUG_IO*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "flesh.h"
+#include "Groups.h"
+#include "Comm.h"
+#include "Misc.h"
+#include "GHExtensions.h"
+#include "declare_parameters.h"
+#include "ioGH.h"
+
+
+void *IOUtil_SetupGH (tFleshConfig *config, int convergence_level, cGH *GH)
+{
+ /* nothing else to allocate but the extension */
+
+ return (malloc (sizeof (ioGH)));
+}
+
+int IOUtil_InitGH(cGH *GH)
+{
+ DECLARE_PARAMETERS
+ int i;
+ ioGH *myGH;
+
+ myGH = (ioGH *) GH->extensions [CCTK_GetGHExtensionHandle ("IO")];
+
+ /* How often to output with each method */
+ myGH->IO_0Devery = IO_every;
+ myGH->IO_1Devery = IO_every;
+ myGH->IO_3Devery = IO_every;
+ myGH->IO_2Devery = IO_every;
+ if (IO_0Devery > 0)
+ myGH->IO_0Devery = IO_0Devery;
+ if (IO_1Devery > 0)
+ myGH->IO_1Devery = IO_1Devery;
+ if (IO_2Devery > 0)
+ myGH->IO_2Devery = IO_2Devery;
+ if (IO_3Devery > 0)
+ myGH->IO_3Devery = IO_3Devery;
+
+ /* Set the output directory */
+ myGH->outpfx_0D = IO_outdir;
+ myGH->outpfx_1D = IO_outdir;
+ myGH->outpfx_2D = IO_outdir;
+ myGH->outpfx_3D = IO_outdir;
+ if (!CCTK_Equals(IO_outdir0D,"IO_outdir"))
+ myGH->outpfx_0D = IO_outdir0D;
+ if (!CCTK_Equals(IO_outdir1D,"IO_outdir"))
+ myGH->outpfx_1D = IO_outdir1D;
+ if (!CCTK_Equals(IO_outdir2D,"IO_outdir"))
+ myGH->outpfx_2D = IO_outdir2D;
+ if (!CCTK_Equals(IO_outdir3D,"IO_outdir"))
+ myGH->outpfx_3D = IO_outdir3D;
+
+ /* Create the output directories */
+ if (myGH->IO_0Devery > 0) {
+ if (CCTK_GetMyProc (GH) == 0) {
+ char *command = (char *) malloc (1024 * sizeof (char));
+
+ sprintf (command, "mkdir -p %s", myGH->outpfx_0D);
+ if (system (command) < 0)
+ CCTK_WARN (1,"Problem creating IO 0D directory");
+ free (command);
+ }
+ }
+ if (myGH->IO_1Devery > 0) {
+ if (CCTK_GetMyProc (GH) == 0) {
+ char *command = (char *) malloc (1024 * sizeof (char));
+
+ sprintf (command, "mkdir -p %s", myGH->outpfx_1D);
+ if (system (command) < 0)
+ CCTK_WARN (1,"Problem creating IO 1D directory");
+ free (command);
+ }
+ }
+ if (myGH->IO_2Devery > 0) {
+ if (CCTK_GetMyProc (GH) == 0) {
+ char *command = (char *) malloc (1024 * sizeof (char));
+
+ sprintf (command, "mkdir -p %s", myGH->outpfx_2D);
+ if (system (command) < 0)
+ CCTK_WARN (1,"Problem creating IO 2D directory");
+ free (command);
+ }
+ }
+ if (myGH->IO_3Devery > 0) {
+ if (CCTK_GetMyProc (GH) == 0) {
+ char *command = (char *) malloc (1024 * sizeof (char));
+
+ sprintf (command, "mkdir -p %s", myGH->outpfx_3D);
+ i = system(command);
+ if (system (command) < 0)
+ CCTK_WARN (1,"Problem creating IO 3D directory");
+ free (command);
+ }
+ }
+
+ /* Create the checkpoint directory */
+ if (checkpoint_every > 0 && CCTK_Equals (checkpoint_dir, IO_outdir) != 0) {
+ if (CCTK_GetMyProc (GH) == 0) {
+ char *command = (char *) malloc (1024 * sizeof (char));
+
+ sprintf (command, "mkdir -p %s", checkpoint_dir);
+ if (system (command) < 0)
+ CCTK_WARN (1,"Problem creating checkpoint directory");
+ free (command);
+ }
+ }
+
+ if (CCTK_Equals (iomode, "proc")) {
+ myGH->ioproc = CCTK_GetMyProc (GH);
+ myGH->nioprocs = CCTK_GetnProcs (GH);
+ myGH->ioproc_every = 1;
+ } else if (CCTK_Equals (iomode, "np")) {
+ if (ioproc_every > CCTK_GetnProcs (GH)) {
+ myGH->ioproc_every = CCTK_GetnProcs (GH);
+ printf ("Reducing ioproc_every to %d\n", myGH->ioproc_every);
+ } else
+ myGH->ioproc_every = ioproc_every;
+
+ myGH->nioprocs = CCTK_GetnProcs (GH) / myGH->ioproc_every +
+ (CCTK_GetnProcs (GH) % myGH->ioproc_every ? 1 : 0);
+ myGH->ioproc = CCTK_GetMyProc (GH) -
+ CCTK_GetMyProc (GH) % myGH->ioproc_every;
+ } else if (CCTK_Equals (iomode, "onefile")) {
+ myGH->ioproc = 0;
+ myGH->nioprocs = 1;
+ myGH->ioproc_every = CCTK_GetnProcs (GH);
+ } else {
+ printf ("I don't understand iomode setting. Using onefile.\n");
+ myGH->ioproc = 0;
+ myGH->nioprocs = 1;
+ myGH->ioproc_every = CCTK_GetnProcs (GH);
+ }
+
+ /* At the moment only have unchunked for a single output file */
+ if (unchunked || CCTK_GetnProcs (GH) == 1) {
+ if (myGH->ioproc_every >= CCTK_GetnProcs (GH))
+ myGH->unchunked = 1;
+ else {
+ printf ("Unchunked output not currently supported for multiple\n");
+ printf ("output files. Output will be chunked.\n");
+ myGH->unchunked = 0;
+ }
+ } else
+ myGH->unchunked = 0;
+
+ /* save downsampling parameters in ioUtilGH because they are temporarily
+ reset during checkpointing */
+ myGH->downsample_x = downsample_x;
+ myGH->downsample_y = downsample_y;
+ myGH->downsample_z = downsample_z;
+
+ /* evaluate the out_single parameter only for Cactus compiled with
+ double precision */
+#ifdef SINGLE_PRECISION
+ myGH->out_single = 0;
+#else
+ myGH->out_single = out_single;
+#endif
+
+ return 0;
+}
+
+int IOUtil_rfrTraverseGH(cGH *GH, int rfrpoint)
+{
+ return 0;
+}
+
+
+/* ===============================================================
+ utility routines used by other IO thorns
+ ===============================================================*/
+
+int InitIONum(int *array, char *string)
+{
+ char *before=NULL;
+ char *after=NULL;
+ char *splitstring;
+ int first,groupnum,i,last,index,varnum;
+
+ /* First initialise every variable to no output */
+ for (i=0; i<CCTK_GetNumVars(); i++)
+ array[i] = 0;
+
+ splitstring=string;
+
+ while(CCTK_SplitString(&before,&after,splitstring," ")==0)
+ {
+
+#ifdef DEBUG_IO
+ printf(" String is -%s-\n",splitstring);
+ printf(" Split is -%s- and -%s-\n",before,after);
+#endif
+
+ if (CCTK_Equals(before," ")) continue;
+
+ if (strlen(before) > 0)
+ {
+
+ /* Look for any special tokens */
+ if (CCTK_Equals(before,"all"))
+ {
+ int ilab;
+ for (ilab=0;ilab<CCTK_GetNumVars();ilab++)
+ array[ilab]=1;
+ }
+
+ /* See if this name is implementation::variable */
+ varnum = CCTK_GetVarIndex(before);
+ if ( varnum < 0 )
+ {
+
+ /* See if this name is implementation::group */
+ groupnum = CCTK_GetGroupIndex(before);
+ if (groupnum < 0)
+ {
+ char *msg;
+ msg = (char *)malloc((100+sizeof(before))*sizeof(char));
+ sprintf(msg,"Ignoring %s in IO string (invalid token)",before);
+ CCTK_WARN(2,msg);
+ free(msg);
+ }
+ else
+ {
+ /* We have a group so now need all the variables in the group */
+ first = CCTK_GetFirstVarIndex_ByIndex(groupnum);
+ last = first+CCTK_GetNumVarsInGroup_ByIndex(groupnum)-1;
+ for (index=first;index<=last;index++)
+ array[index] = 1;
+ }
+ }
+ else
+ {
+ array[varnum] = 1;
+ }
+ }
+ splitstring = after;
+ }
+
+ if (strlen(splitstring)>0)
+ {
+
+ /* Special cases */
+ if (CCTK_Equals(splitstring,"all"))
+ {
+ int ilab;
+ for (ilab=0;ilab<CCTK_GetNumVars();ilab++)
+ array[ilab]=1;
+ }
+
+ varnum = CCTK_GetVarIndex(splitstring);
+ if (varnum < 0)
+ {
+ groupnum = CCTK_GetGroupIndex(splitstring);
+ if (groupnum < 0)
+ {
+ char *msg;
+ msg = (char *)malloc((100+sizeof(splitstring))*sizeof(char));
+ sprintf(msg,"Ignoring %s in IO string (invalid token)",splitstring);
+ CCTK_WARN(2,msg);
+ free(msg);
+ }
+ else
+ {
+ /* We have a group so now need all the variables in the group */
+ first = CCTK_GetFirstVarIndex_ByIndex(groupnum);
+ last = first+CCTK_GetNumVarsInGroup_ByIndex(groupnum)-1;
+ for (index=first;index<=last;index++)
+ array[index] = 1;
+ }
+ }
+ else
+ {
+ array[varnum] = 1;
+ }
+ }
+
+ if (before) free(before);
+ if (after) free(after);
+
+ return 0;
+}
diff --git a/src/Startup.c b/src/Startup.c
new file mode 100644
index 0000000..819606d
--- /dev/null
+++ b/src/Startup.c
@@ -0,0 +1,48 @@
+ /*@@
+ @file Startup.c
+ @date Sat Feb 6 1999
+ @author Gabrielle Allen
+ @desc
+ Startup routines for IOUtil.
+ @enddesc
+ @@*/
+
+static char *rcsid="$Header$";
+
+#include <stdio.h>
+
+#include "flesh.h"
+#include "GHExtensions.h"
+
+
+/* prototypes of functions to be registered */
+void *IOUtil_SetupGH (tFleshConfig *config, int convergence_level, cGH *GH);
+int IOUtil_InitGH (cGH *GH);
+int IOUtil_rfrTraverseGH (cGH *GH, int rfrpoint);
+
+
+ /*@@
+ @routine IOUtil_Startup
+ @date Sat Feb 6 1999
+ @author Gabrielle Allen
+ @desc
+ The startup registration routine for IOUtil.
+ Registers the GH extensions needed for IOUtil.
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
+void IOUtil_Startup(void)
+{
+ int IOMethod;
+ int IO_GHExtension;
+
+ IO_GHExtension = CCTK_RegisterGHExtension("IO");
+ CCTK_RegisterGHExtensionSetupGH(IO_GHExtension, IOUtil_SetupGH);
+ CCTK_RegisterGHExtensionInitGH(IO_GHExtension, IOUtil_InitGH);
+ CCTK_RegisterGHExtensionrfrTraverseGH(IO_GHExtension, IOUtil_rfrTraverseGH);
+}
diff --git a/src/ioGH.h b/src/ioGH.h
new file mode 100644
index 0000000..c394c31
--- /dev/null
+++ b/src/ioGH.h
@@ -0,0 +1,54 @@
+ /*@@
+ @header ioGH.h
+ @date Tue 9th Jan 1999
+ @author Gabrielle Allen
+ @desc
+ The extensions to the GH structure from IOUtil.
+ @history
+ @hauthor Thomas Radke @hdate 16 Mar 1999
+ @hdesc Added parameters for 2D and 3D output
+ @hauthor Thomas Radke @hdate 17 Mar 1999
+ @hdesc Changed naming: IEEEIO -> FlexIO
+ @hauthor Thomas Radke @hdate 30 Mar 1999
+ @hdesc Undefined DI macro
+ @endhistory
+ @version $Header$
+ @@*/
+
+
+typedef struct IOGH {
+
+ /* How often to output */
+ int IO_0Devery;
+ int IO_1Devery;
+ int IO_2Devery;
+ int IO_3Devery;
+
+ /* Directory in which to output */
+ char *outpfx_0D;
+ char *outpfx_1D;
+ char *outpfx_2D;
+ char *outpfx_3D;
+
+ /* Lines for 1D output */
+ int spxyz[3];
+
+ /* for 3D output */
+ int ioproc; /* the IO processor each proc belongs to */
+ int nioprocs; /* total number of IO processors */
+ int ioproc_every; /* output by every N'th processor */
+ int unchunked; /* if true generate unchunked output file */
+ int downsample_x, /* downsampling parameters */
+ downsample_y,
+ downsample_z;
+ int out_single; /* if true output 3D data in single precision */
+
+} ioGH;
+
+/* enums for checkpointing/recovery and filereader functions */
+enum {CP_INITIAL_DATA, CP_EVOLUTION_DATA, CP_RECOVER_DATA, FILEREADER_DATA};
+
+/* prototypes of routines that are exported by IOUtil to other IO thorns */
+extern int InitIONum (int *array, char *string);
+extern void IO_PrepareFilename (cGH *GH, const char *basename, char *fname,
+ int called_from, int ioproc,int file_unchunked);
diff --git a/src/make.code.defn b/src/make.code.defn
new file mode 100644
index 0000000..9f7b8ea
--- /dev/null
+++ b/src/make.code.defn
@@ -0,0 +1 @@
+SRCS = Startup.c GHExtension.c CheckpointRecovery.c