diff options
author | tradke <tradke@4825ed28-b72c-4eae-9704-e50c059e567d> | 2002-05-06 09:21:30 +0000 |
---|---|---|
committer | tradke <tradke@4825ed28-b72c-4eae-9704-e50c059e567d> | 2002-05-06 09:21:30 +0000 |
commit | 05b0fe4b1f1337319fbd1beb6928610bb92f57b3 (patch) | |
tree | cc453d31302e5633d4114666a7747d4c7bebe12b /src | |
parent | cfd0aa21d5237ba08b06f687c21f5d1d56a41003 (diff) |
Parameter names changes as announced in today's mail to users@cactuscode.org.
You must also update thorns IOHDF5Util and IOUtil now.
This thorn will be moved from AlphaThorns to CactusPUGHIO now.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5/trunk@127 4825ed28-b72c-4eae-9704-e50c059e567d
Diffstat (limited to 'src')
-rw-r--r-- | src/DumpGH.c | 16 | ||||
-rw-r--r-- | src/Output.c | 60 | ||||
-rw-r--r-- | src/RecoverGH.c | 20 | ||||
-rw-r--r-- | src/Startup.c | 54 | ||||
-rw-r--r-- | src/Write.c | 49 | ||||
-rw-r--r-- | src/WriteIsosurface.c | 4 | ||||
-rw-r--r-- | src/ioHDF5GH.h | 11 |
7 files changed, 91 insertions, 123 deletions
diff --git a/src/DumpGH.c b/src/DumpGH.c index b9d5674..952cbc0 100644 --- a/src/DumpGH.c +++ b/src/DumpGH.c @@ -16,7 +16,7 @@ #include "cctk_Parameters.h" #include "CactusBase/IOUtil/src/ioGH.h" #include "CactusBase/IOUtil/src/ioutil_CheckpointRecovery.h" -#include "BetaThorns/IOHDF5Util/src/ioHDF5UtilGH.h" +#include "CactusPUGHIO/IOHDF5Util/src/ioHDF5UtilGH.h" #ifdef CCTK_MPI #include "CactusPUGH/PUGH/src/include/pugh.h" #endif @@ -30,7 +30,7 @@ /* the rcs ID and its dummy function to use it */ static const char *rcsid = "$Header$"; -CCTK_FILEVERSION(AlphaThorns_IOHDF5_DumpGH_c) +CCTK_FILEVERSION(CactusPUGHIO_IOHDF5_DumpGH_c) /******************************************************************** @@ -102,7 +102,7 @@ void IOHDF5_EvolutionCheckpoint (const cGH *GH) ((checkpoint_every > 0 && GH->cctk_iteration % checkpoint_every == 0) || checkpoint_next)) { - if (verbose) + if (! CCTK_Equals (verbose, "none")) { CCTK_INFO("------------------------------------------------------------"); CCTK_VInfo (CCTK_THORNSTRING, "Dumping periodic checkpoint file at " @@ -232,7 +232,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 checkpoint file '%s'", cp_tempname); @@ -269,7 +269,7 @@ static int Checkpoint (const cGH *GH, int called_from) /* close the temporary checkpoint file and rename it to the real file */ if (myproc == ioUtilGH->ioproc) { - if (verbose) + if (CCTK_Equals (verbose, "full")) { CCTK_VInfo (CCTK_THORNSTRING, "Closing temporary checkpoint file '%s' " "and renaming it to '%s'", @@ -281,7 +281,7 @@ static int Checkpoint (const cGH *GH, int called_from) HDF5_ERROR (H5Fclose (file)); } - /* delete the oldest checkpoint file if checkpoint_keep_all isn't set + /* delete the oldest checkpoint file if requested and put the new filename into the ring buffer */ if (retval == 0) { @@ -301,14 +301,14 @@ static int Checkpoint (const cGH *GH, int called_from) { if (myGH->cp_filename_list[myGH->cp_filename_index]) { - if (! checkpoint_keep_all) + if (checkpoint_keep > 0) { remove (myGH->cp_filename_list[myGH->cp_filename_index]); } free (myGH->cp_filename_list[myGH->cp_filename_index]); } myGH->cp_filename_list[myGH->cp_filename_index] = strdup (cp_filename); - myGH->cp_filename_index = (myGH->cp_filename_index+1) % checkpoint_keep; + myGH->cp_filename_index = (myGH->cp_filename_index+1) % abs (checkpoint_keep); } } } diff --git a/src/Output.c b/src/Output.c index b06e979..fb0f0d9 100644 --- a/src/Output.c +++ b/src/Output.c @@ -16,8 +16,8 @@ #include "ioHDF5GH.h" /* the rcs ID and its dummy function to use it */ -static const char *rcsid = "$Id$"; -CCTK_FILEVERSION(AlphaThorns_IOHDF5_Output_c) +static const char *rcsid = "$Header$"; +CCTK_FILEVERSION(CactusPUGHIO_IOHDF5_Output_c) /******************************************************************** @@ -35,10 +35,10 @@ static void CheckSteerableParameters (const cGH *GH); @enddesc @calls IOHDF5_TimeFor - IOHDF5_OutputVarAs + IOHDF5_Write @var GH - @vdesc Pointer to CCTK GH + @vdesc pointer to CCTK GH @vtype const cGH * @vio in @endvar @@ -52,43 +52,21 @@ static void CheckSteerableParameters (const cGH *GH); int IOHDF5_OutputGH (const cGH *GH) { int vindex, retval; - ioHDF5GH *myGH; - char *fullname; - const char *name; - DECLARE_CCTK_PARAMETERS - - - myGH = (ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5"); + const ioHDF5GH *myGH; - CheckSteerableParameters (GH); - if (myGH->out_every <= 0) - { - return (0); - } + retval = 0; + myGH = (const ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5"); /* loop over all variables */ - for (vindex = retval = 0; vindex < CCTK_NumVars (); vindex++) + for (vindex = CCTK_NumVars () - 1; vindex >= 0; vindex--) { - if (IOHDF5_TimeFor (GH, vindex)) + if (IOHDF5_TimeFor (GH, vindex) && + IOHDF5_Write (GH, vindex, CCTK_VarName (vindex)) == 0) { - name = CCTK_VarName (vindex); - fullname = CCTK_FullName (vindex); - - if (verbose) - { - CCTK_VInfo (CCTK_THORNSTRING, "IOHDF5_OutputGH: (fullname, name) = " - "(%s, %s)", fullname, name); - } - - if (IOHDF5_OutputVarAs (GH, fullname, name) == 0) - { - /* register variable 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++; } } @@ -107,7 +85,7 @@ int IOHDF5_OutputGH (const cGH *GH) @calls IOHDF5_Write @var GH - @vdesc Pointer to CCTK GH + @vdesc pointer to CCTK GH @vtype const cGH * @vio in @endvar @@ -137,7 +115,7 @@ int IOHDF5_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, "IOHDF5_OutputVarAs: fullname, alias, " "index = (%s, %s, %d)", fullname, alias, vindex); @@ -175,7 +153,7 @@ int IOHDF5_OutputVarAs (const cGH *GH, const char *fullname, const char *alias) @calls CheckSteerableParameters @var GH - @vdesc Pointer to CCTK GH + @vdesc pointer to CCTK GH @vtype const cGH * @vio in @endvar @@ -233,7 +211,7 @@ int IOHDF5_TimeFor (const cGH *GH, int vindex) @calls IOHDF5_Write @var GH - @vdesc Pointer to CCTK GH + @vdesc pointer to CCTK GH @vtype const cGH * @vio in @endvar @@ -261,7 +239,7 @@ int IOHDF5_TriggerOutput (const cGH *GH, int vindex) myGH = (ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5"); - if (verbose) + if (CCTK_Equals (verbose, "full")) { fullname = CCTK_FullName (vindex); CCTK_VInfo (CCTK_THORNSTRING, "IOHDF5_TriggerOutput: " @@ -298,7 +276,7 @@ int IOHDF5_TriggerOutput (const cGH *GH, int vindex) @calls IOHDF5Util_ParseVarsForOutput @var GH - @vdesc Pointer to CCTK grid hierarchy + @vdesc pointer to CCTK grid hierarchy @vtype const cGH * @vio in @endvar diff --git a/src/RecoverGH.c b/src/RecoverGH.c index e8c4b8d..4732cea 100644 --- a/src/RecoverGH.c +++ b/src/RecoverGH.c @@ -26,7 +26,7 @@ /* the rcs ID and its dummy function to use it */ -static const char *rcsid = "$Id$"; +static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusPUGHIO_IOHDF5_RecoverGH_c) @@ -138,7 +138,7 @@ int IOHDF5_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"); } @@ -148,7 +148,7 @@ int IOHDF5_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", fileinfo.unchunked ? "un" : "", @@ -160,7 +160,7 @@ int IOHDF5_Recover (cGH *GH, const char *basefilename, int called_from) /* Close the file and remove it if requested by the user */ if (CCTK_MyProc (GH) == fileinfo.ioproc) { - if (verbose) + if (CCTK_Equals (verbose, "full")) { if (called_from == CP_RECOVER_DATA) { @@ -177,7 +177,7 @@ int IOHDF5_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, "Old checkpoint file '%s' will be removed" " after next successful checkpoint", @@ -337,7 +337,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'", filename); } @@ -361,7 +361,7 @@ static int OpenFile (cGH *GH, const char *basefilename, int called_from, fileinfo->unchunked); strcat (filename, ".h5"); - if (verbose) + if (CCTK_Equals (verbose, "full")) { CCTK_VInfo (CCTK_THORNSTRING, "Trying now file '%s'...", filename); } @@ -417,7 +417,7 @@ static int OpenFile (cGH *GH, const char *basefilename, int called_from, if ((fileinfo->ioproc_every == nprocs && nprocs > 1) || fileinfo->unchunked) { - if (verbose) + if (! CCTK_Equals (verbose, "none")) { CCTK_VInfo (CCTK_THORNSTRING, "Recovering from one %schunked file", fileinfo->unchunked ? "un" : ""); @@ -435,7 +435,7 @@ static int OpenFile (cGH *GH, const char *basefilename, int called_from, } else { - if (verbose) + if (! CCTK_Equals (verbose, "none")) { CCTK_VInfo (CCTK_THORNSTRING, "Recovering from %d chunked files", nprocs / fileinfo->ioproc_every + @@ -481,7 +481,7 @@ static int OpenFile (cGH *GH, const char *basefilename, int called_from, /* Open chunked files on other IO processors */ if (myproc == fileinfo->ioproc && myproc != 0) { - if (verbose) + if (CCTK_Equals (verbose, "full")) { CCTK_VInfo (CCTK_THORNSTRING, "Opening chunked file '%s' on " "processor %d", filename, myproc); diff --git a/src/Startup.c b/src/Startup.c index 28efa08..15b7049 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -19,8 +19,8 @@ #include "ioHDF5GH.h" /* the rcs ID and its dummy function to use it */ -static const char *rcsid = "$Id$"; -CCTK_FILEVERSION(AlphaThorns_IOHDF5_Startup_c) +static const char *rcsid = "$Header$"; +CCTK_FILEVERSION(CactusPUGHIO_IOHDF5_Startup_c) /******************************************************************** @@ -130,51 +130,55 @@ static void *SetupGH (tFleshConfig *config, int conv_level, cGH *GH) myGH = (ioHDF5GH *) malloc (sizeof (ioHDF5GH)); myGH->out_last = (int *) malloc (numvars * sizeof (int)); myGH->requests = (ioRequest **) calloc (numvars, sizeof (ioRequest *)); - myGH->cp_filename_list = (char **) calloc (checkpoint_keep, sizeof (char *)); + myGH->cp_filename_list = (char **) calloc (abs (checkpoint_keep), + sizeof (char *)); myGH->cp_filename_index = 0; - /* Check whether "IOHDF5::outdir" was set. - If so take this directory otherwise default to "IO::outdir" */ - if (CCTK_ParameterQueryTimesSet ("outdir", CCTK_THORNSTRING) > 0 || - CCTK_ParameterQueryTimesSet ("outdir_HDF5", CCTK_THORNSTRING) > 0) + /* get the name of IOHDF5's output directory */ + if (*out_dir == 0) { - if (CCTK_ParameterQueryTimesSet ("outdir", CCTK_THORNSTRING) <= 0) - { - CCTK_WARN (1, "Parameter 'IOHDF5::outdir_HDF5 is depricated in BETA12, " - "please use 'IOHDF5::outdir' instead"); - outdir = outdir_HDF5; - } + out_dir = *(const char **) + CCTK_ParameterGet ("out_dir", CCTK_ImplementationThorn ("IO"), + NULL); + } - if (CCTK_Equals (out3D_mode, "onefile") || ! strstr (outdir, "%u")) + /* skip the directory pathname if output goes into current directory */ + if (strcmp (out_dir, ".")) + { + i = strlen (out_dir); + if (CCTK_Equals (out_mode, "onefile") || ! strstr (out_dir, "%u")) { - myGH->outdir = strdup (outdir); + myGH->out_dir = (char *) malloc (i + 2); + strcpy (myGH->out_dir, out_dir); + myGH->out_dir[i] = '/'; + myGH->out_dir[i+1] = 0; } else { - myGH->outdir = (char *) malloc (strlen (outdir) + 20); - sprintf (myGH->outdir, outdir, CCTK_MyProc (GH)); + myGH->out_dir = (char *) malloc (i + 20); + sprintf (myGH->out_dir, out_dir, CCTK_MyProc (GH)); + strcat (myGH->out_dir, "/"); } } else { - myGH->outdir = CCTK_ParameterValString ("outdir", - CCTK_ImplementationThorn ("IO")); + myGH->out_dir = strdup (""); } - /* Create the output directory */ + /* create the output directory */ ioUtilGH = (const ioGH *) CCTK_GHExtension (GH, "IO"); - 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, - "Problem creating HDF5 output directory '%s'", myGH->outdir); + "Problem creating HDF5 output 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, - "HDF5 output directory '%s' already exists", myGH->outdir); + "HDF5 output directory '%s' already exists", myGH->out_dir); } for (i = 0; i < numvars; i++) diff --git a/src/Write.c b/src/Write.c index b21c2d2..c4d3b50 100644 --- a/src/Write.c +++ b/src/Write.c @@ -21,7 +21,7 @@ /* the rcs ID and its dummy funtion to use it */ static const char *rcsid = "$Header$"; -CCTK_FILEVERSION(AlphaThorns_IOHDF5_Write_c) +CCTK_FILEVERSION(CactusPUGHIO_IOHDF5_Write_c) /******************************************************************** @@ -113,7 +113,7 @@ int IOHDF5_Write (const cGH *GH, int vindex, const char *alias) } else { - if (verbose) + if (CCTK_Equals (verbose, "full")) { CCTK_VInfo (CCTK_THORNSTRING, "%s HDF5 output file '%s'", is_new_file ? "Opening" : "Appending", filename); @@ -154,9 +154,10 @@ int IOHDF5_Write (const cGH *GH, int vindex, const char *alias) { /* all GH extension variables and parameter stuff which is not specific to any dataset goes into dedicated groups */ - if (strcmp (out3D_parameters, "no")) + if (! CCTK_Equals (out_save_parameters, "no")) { - IOHDF5Util_DumpParameters (GH, ! strcmp (out3D_parameters, "all"), file); + IOHDF5Util_DumpParameters (GH, CCTK_Equals (out_save_parameters, "all"), + file); } IOHDF5Util_DumpGHExtensions (GH, file); @@ -168,16 +169,15 @@ int IOHDF5_Write (const cGH *GH, int vindex, const char *alias) /* close the file */ if (file >= 0) { - if (verbose) + if (CCTK_Equals (verbose, "full")) { CCTK_INFO ("Closing HDF5 output file from this iteration"); } HDF5_ERROR (H5Fclose (file)); } - /* free the filename if it was not registered for re-opening - in IOHDF5_net3D_filename () */ - if (out3D_septimefiles) + /* free the filename if it was not registered for re-opening */ + if (out_timesteps_per_file > 0) { free (filename); } @@ -259,7 +259,7 @@ static char *IOHDF5_GetFilename (const cGH *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); @@ -289,26 +289,18 @@ static char *IOHDF5_GetFilename (const cGH *GH, sprintf (extra, "%s.file_%d", extra, myproc / ioUtilGH->ioproc_every); /* If necessary create the output directory */ - outputdir = (char *) malloc (strlen (myGH->outdir) + strlen (varname) + 5); - - if (strcmp (myGH->outdir, ".")) - { - sprintf (outputdir, "%s/%s_3d", myGH->outdir, varname); - } - else - { - sprintf (outputdir, "%s_3d", varname); - } + outputdir = (char *) malloc (strlen (myGH->out_dir) + strlen (varname) + 5); + sprintf (outputdir, "%s%s_3d", myGH->out_dir, varname); 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 output directory '%s'", outputdir); } - else if (result > 0 && CCTK_Equals (newverbose, "full")) + else if (result > 0 && CCTK_Equals (verbose, "full")) { CCTK_VInfo (CCTK_THORNSTRING, "Output directory '%s' already exists", outputdir); @@ -327,23 +319,16 @@ static char *IOHDF5_GetFilename (const cGH *GH, /* CREATE THE COMPLETE OUTPUT FILENAME ----------------------------------- */ - filename = (char *) malloc (strlen (myGH->outdir) + + filename = (char *) malloc (strlen (myGH->out_dir) + strlen (extradir) + strlen (varname) + strlen (extra) + strlen (GH->identity) + 8); - if (strcmp (myGH->outdir, ".")) - { - sprintf (filename, "%s/%s%s%s%s.h5", - myGH->outdir, extradir, varname, extra, GH->identity); - } - else - { - sprintf (filename, "%s%s%s%s.h5", extradir, varname, extra, GH->identity); - } + sprintf (filename, "%s%s%s%s%s.h5", + myGH->out_dir, extradir, varname, extra, GH->identity); /* no need to store filenames if used only once */ - if (! out3D_septimefiles) + if (out_timesteps_per_file < 0) { if (myproc == ioUtilGH->ioproc) { diff --git a/src/WriteIsosurface.c b/src/WriteIsosurface.c index 3e7e573..be12eb8 100644 --- a/src/WriteIsosurface.c +++ b/src/WriteIsosurface.c @@ -16,8 +16,8 @@ #include "ioHDF5GH.h" /* the rcs ID and its dummy funtion to use it */ -static const char *rcsid = "$Id$"; -CCTK_FILEVERSION(AlphaThorns_IOHDF5_WriteIsosurface_c) +static const char *rcsid = "$Header$"; +CCTK_FILEVERSION(CactusPUGHIO_IOHDF5_WriteIsosurface_c) #define SOCKET_URL_PREFIX "sock://" diff --git a/src/ioHDF5GH.h b/src/ioHDF5GH.h index 1c2fc5a..31c5fc0 100644 --- a/src/ioHDF5GH.h +++ b/src/ioHDF5GH.h @@ -4,14 +4,15 @@ @author Thomas Radke @desc The extensions to the GH structure from IOHDF5. - @version $Id$ + @enddesc + @version $Header$ @@*/ #ifndef _IOHDF5_IOHDF5GH_H_ -#define _IOHDF5_IOHDF5GH_H_ +#define _IOHDF5_IOHDF5GH_H_ 1 -#include "BetaThorns/IOHDF5Util/src/ioHDF5UtilGH.h" #include "StoreNamedData.h" +#include "CactusPUGHIO/IOHDF5Util/src/ioHDF5UtilGH.h" /* IOHDF5 GH extension structure */ typedef struct @@ -20,8 +21,8 @@ typedef struct /* how often to output */ int out_every; - /* directories in which to output */ - char *outdir; + /* directory in which to output */ + char *out_dir; /* the last iteration output */ int *out_last; |