diff options
author | tradke <tradke@4825ed28-b72c-4eae-9704-e50c059e567d> | 2002-04-17 08:42:50 +0000 |
---|---|---|
committer | tradke <tradke@4825ed28-b72c-4eae-9704-e50c059e567d> | 2002-04-17 08:42:50 +0000 |
commit | 31bb9a3c76d7e18d4cce38c6dc3010bb5ef0f8ed (patch) | |
tree | fe64ab5d800ea2df189e51c21cfb0b29a8fc3523 /src | |
parent | d8aa32794e141b22fa9954b4ec3afe6b8ae50d8a (diff) |
Just some minor changes before doing the transition to use the new hyperslabbing
API: completed grdoc, put in some more comments, removed dead code.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5/trunk@117 4825ed28-b72c-4eae-9704-e50c059e567d
Diffstat (limited to 'src')
-rw-r--r-- | src/DumpGH.c | 29 | ||||
-rw-r--r-- | src/Output.c | 19 | ||||
-rw-r--r-- | src/RecoverGH.c | 88 | ||||
-rw-r--r-- | src/Startup.c | 115 | ||||
-rw-r--r-- | src/Write.c | 111 |
5 files changed, 162 insertions, 200 deletions
diff --git a/src/DumpGH.c b/src/DumpGH.c index 5ede0f2..048c6ed 100644 --- a/src/DumpGH.c +++ b/src/DumpGH.c @@ -33,10 +33,17 @@ static const char *rcsid = "$Id$"; CCTK_FILEVERSION(AlphaThorns_IOHDF5_DumpGH_c) -/* prototypes of routines defined in this source file */ +/******************************************************************** + ******************** External Routines ************************ + ********************************************************************/ void IOHDF5_InitialDataCheckpoint (cGH *GH); void IOHDF5_EvolutionCheckpoint (cGH *GH); void IOHDF5_TerminationCheckpoint (cGH *GH); + + +/******************************************************************** + ******************** Internal Routines ************************ + ********************************************************************/ static int IOHDF5_Checkpoint (cGH *GH, int called_from); @@ -141,9 +148,9 @@ void IOHDF5_TerminationCheckpoint (cGH *GH) } -/*****************************************************************************/ -/* local routines */ -/*****************************************************************************/ +/******************************************************************** + ******************** Internal Routines ************************ + ********************************************************************/ /*@@ @routine IOHDF5_Checkpoint @date Fri Aug 21 15:13:13 1998 @@ -182,8 +189,14 @@ static int IOHDF5_Checkpoint (cGH *GH, int called_from) CCTK_INT retval; ioGH *ioUtilGH; ioHDF5GH *myGH; +#ifdef CCTK_MPI + CCTK_INT tmp; +#endif /* FIXME: allocate filenames dynamically */ char cp_filename[1024], cp_tempname[1024]; + const char *timer_descriptions[3] = {"Time to dump parameters: ", + "Time to dump datasets: ", + "Total time to checkpoint:"}; DECLARE_CCTK_PARAMETERS @@ -248,9 +261,6 @@ static int IOHDF5_Checkpoint (cGH *GH, int called_from) /* find out whether all IO processors succeeded in writing the checkpoint */ if (ioUtilGH->nioprocs > 1) { - CCTK_INT tmp; - - tmp = retval; CACTUS_MPI_ERROR (MPI_Allreduce (&tmp, &retval, 1, PUGH_MPI_INT, MPI_SUM, PUGH_pGH (GH)->PUGH_COMM_WORLD)); @@ -307,11 +317,6 @@ static int IOHDF5_Checkpoint (cGH *GH, int called_from) /* stop the CP_TOTAL_TIMER timer and print timing information */ if (myGH->print_timing_info) { - const char *timer_descriptions[3] = {"Time to dump parameters: ", - "Time to dump datasets: ", - "Total time to checkpoint:"}; - - CCTK_TimerStopI (myGH->timers[CP_TOTAL_TIMER]); IOUtil_PrintTimings ("Timing information for checkpointing with IOHDF5:", 3, myGH->timers, timer_descriptions); diff --git a/src/Output.c b/src/Output.c index f9186d3..9f91ae0 100644 --- a/src/Output.c +++ b/src/Output.c @@ -53,8 +53,8 @@ int IOHDF5_OutputGH (const cGH *GH) { int vindex, retval; ioHDF5GH *myGH; - const char *name; char *fullname; + const char *name; DECLARE_CCTK_PARAMETERS @@ -79,8 +79,8 @@ int IOHDF5_OutputGH (const cGH *GH) if (verbose) { - CCTK_VInfo (CCTK_THORNSTRING, "IOHDF5_OutputGH: (fullname / name) = " - "(%s / %s)", fullname, name); + CCTK_VInfo (CCTK_THORNSTRING, "IOHDF5_OutputGH: (fullname, name) = " + "(%s, %s)", fullname, name); } if (IOHDF5_OutputVarAs (GH, fullname, name) == 0) @@ -103,8 +103,7 @@ int IOHDF5_OutputGH (const cGH *GH) @date Sat March 6 1999 @author Gabrielle Allen @desc - Unconditional output of a variable - using the IOHDF5 output method. + Unconditional output of a variable using the IOHDF5 I/O method. @enddesc @calls IOHDF5_Write @@ -292,9 +291,9 @@ int IOHDF5_TriggerOutput (const cGH *GH, int vindex) } -/***************************************************************************/ -/* local functions */ -/***************************************************************************/ +/******************************************************************** + ******************** Internal Routines ************************ + ********************************************************************/ /*@@ @routine CheckSteerableParameters @date Mon Oct 10 2000 @@ -314,7 +313,7 @@ int IOHDF5_TriggerOutput (const cGH *GH, int vindex) @@*/ static void CheckSteerableParameters (ioHDF5GH *myGH) { - int type, times_set; + int times_set; static int out_vars_lastset = -1, user_was_warned = 0; DECLARE_CCTK_PARAMETERS @@ -342,7 +341,7 @@ static void CheckSteerableParameters (ioHDF5GH *myGH) myGH->out_every = *(const CCTK_INT *) CCTK_ParameterGet ("out_every", CCTK_ImplementationThorn ("IO"), - &type); + NULL); if (myGH->out_every == 0) { myGH->out_every = -1; diff --git a/src/RecoverGH.c b/src/RecoverGH.c index 5243a70..a6854bf 100644 --- a/src/RecoverGH.c +++ b/src/RecoverGH.c @@ -30,8 +30,15 @@ static const char *rcsid = "$Id$"; CCTK_FILEVERSION(CactusPUGHIO_IOHDF5_RecoverGH_c) -/* prototypes of routines defined in this source file */ +/******************************************************************** + ******************** External Routines ************************ + ********************************************************************/ int IOHDF5_RecoverParameters (void); + + +/******************************************************************** + ******************** Internal Routines ************************ + ********************************************************************/ static int IOHDF5_OpenFile (cGH *GH, const char *basefilename, int called_from, @@ -82,15 +89,15 @@ static int IOHDF5_OpenFile (cGH *GH, @seeroutine IOHDF5Util_RecoverGHextensions @endreturndesc @@*/ -int IOHDF5_Recover (cGH *GH, - const char *basefilename, - int called_from) +int IOHDF5_Recover (cGH *GH, const char *basefilename, int called_from) { - DECLARE_CCTK_PARAMETERS int result; ioHDF5GH *myGH; static fileinfo_t fileinfo; /* this is static because info is passed from CP_RECOVERY_PARAMETERS to CP_RECOVERY_DATA */ + const char *timer_description = "Time to recover:"; + DECLARE_CCTK_PARAMETERS + result = 0; @@ -192,9 +199,6 @@ int IOHDF5_Recover (cGH *GH, /* stop total recovery timer and print timing info */ if (called_from == CP_RECOVER_DATA && myGH->print_timing_info) { - const char *timer_description = "Time to recover:"; - - CCTK_TimerStopI (myGH->timers[RECOVERY_TIMER]); IOUtil_PrintTimings ("Timing information for recovery in IOHDF5:", 1, &myGH->timers[RECOVERY_TIMER], &timer_description); @@ -237,9 +241,8 @@ int IOHDF5_Recover (cGH *GH, @returntype int @returndesc - -1 if an invalid reocvery mode was set - or the returncode of - @seeroutine IOUtil_RecoverParameters + returncode of @seeroutine IOUtil_RecoverParameters + @endreturndesc @@*/ int IOHDF5_RecoverParameters (void) { @@ -297,18 +300,15 @@ static int IOHDF5_OpenFile (cGH *GH, int called_from, fileinfo_t *fileinfo) { - DECLARE_CCTK_PARAMETERS - int nprocs; - int myproc; + int nprocs, myproc; hid_t group, version_attr; /* FIXME: want dynamic allocation of the filename */ char filename[256]; - H5E_auto_t print_error_fn; - void *print_error_fn_arg; #ifdef CCTK_MPI MPI_Comm comm; CCTK_INT4 info[4]; #endif + DECLARE_CCTK_PARAMETERS #ifdef CCTK_MPI @@ -346,37 +346,33 @@ static int IOHDF5_OpenFile (cGH *GH, CCTK_VInfo (CCTK_THORNSTRING, "Opening file '%s'", filename); } - /* turn automatic error printing off again during check - but preserving the previous error handler settings */ - IOHDF5_ERROR (H5Eget_auto (&print_error_fn, &print_error_fn_arg)); - IOHDF5_ERROR (H5Eset_auto (NULL, NULL)); - - /* Check the filetype */ - if (H5Fis_hdf5 (filename) > 0) - { - fileinfo->is_HDF5_file = 1; - } - else + /* turn automatic error printing off again during check */ + H5E_BEGIN_TRY { - CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, - "No valid HDF5 file '%s' found", filename); - - /* now try with chunked mode */ - fileinfo->unchunked = 0; - IOUtil_PrepareFilename (GH, basefilename, filename, called_from, 0, - fileinfo->unchunked); - strcat (filename, ".h5"); - - if (verbose) + /* Check the filetype */ + if (H5Fis_hdf5 (filename) > 0) { - CCTK_VInfo (CCTK_THORNSTRING, "Trying now file '%s'...", filename); + fileinfo->is_HDF5_file = 1; } + else + { + CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, + "No valid HDF5 file '%s' found", filename); - fileinfo->is_HDF5_file = H5Fis_hdf5 (filename) > 0; - } + /* now try with chunked mode */ + fileinfo->unchunked = 0; + IOUtil_PrepareFilename (GH, basefilename, filename, called_from, 0, + fileinfo->unchunked); + strcat (filename, ".h5"); - /* turn automatic error printing on again */ - IOHDF5_ERROR (H5Eset_auto (print_error_fn, print_error_fn_arg)); + if (verbose) + { + CCTK_VInfo (CCTK_THORNSTRING, "Trying now file '%s'...", filename); + } + + fileinfo->is_HDF5_file = H5Fis_hdf5 (filename) > 0; + } + } H5E_END_TRY; } /* Okay, we have the complete filename. Let's read the file now. */ @@ -405,10 +401,10 @@ static int IOHDF5_OpenFile (cGH *GH, /* check if there exists a version attribute For this we temporarily turn off automatic error printing. */ - IOHDF5_ERROR (H5Eget_auto (&print_error_fn, &print_error_fn_arg)); - IOHDF5_ERROR (H5Eset_auto (NULL, NULL)); - version_attr = H5Aopen_name (group, "Cactus version"); - IOHDF5_ERROR (H5Eset_auto (print_error_fn, print_error_fn_arg)); + H5E_BEGIN_TRY + { + version_attr = H5Aopen_name (group, "Cactus version"); + } H5E_END_TRY; fileinfo->has_version = version_attr >= 0; if (version_attr >= 0) diff --git a/src/Startup.c b/src/Startup.c index d455468..b213adf 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -2,9 +2,9 @@ @file Startup.c @date Fri May 21 1999 @author Thomas Radke - @desc + @desc Startup and termination routines for IOHDF5. - @enddesc + @enddesc @version $Id$ @@*/ @@ -24,8 +24,15 @@ static const char *rcsid = "$Id$"; CCTK_FILEVERSION(AlphaThorns_IOHDF5_Startup_c) -/* local function prototypes */ +/******************************************************************** + ******************** External Routines ************************ + ********************************************************************/ void IOHDF5_Startup (void); + + +/******************************************************************** + ******************** Internal Routines ************************ + ********************************************************************/ static void *IOHDF5_SetupGH (tFleshConfig *config, int convergence_level, cGH *GH); @@ -35,89 +42,90 @@ static void *IOHDF5_SetupGH (tFleshConfig *config, @routine IOHDF5_Startup @date Fri May 21 1999 @author Thomas Radke - @desc + @desc The startup registration routine for IOHDF5. Registers the GH extensions needed for IOHDF5 along with its setup routine. - @enddesc + @enddesc - @calls CCTK_RegisterGHExtensionSetupGH + @calls CCTK_RegisterGHExtension + CCTK_RegisterGHExtensionSetupGH @@*/ void IOHDF5_Startup (void) { /* check that thorn IOHDF5Util was activated */ - if (CCTK_GHExtensionHandle ("IOHDF5Util") < 0) + if (CCTK_GHExtensionHandle ("IOHDF5Util") >= 0) + { + CCTK_RegisterGHExtensionSetupGH (CCTK_RegisterGHExtension ("IOHDF5"), + IOHDF5_SetupGH); + } + else { CCTK_WARN (1, "Thorn IOHDF5Util was not activated. " "No IOHDF5 IO methods will be registered."); - return; } - - CCTK_RegisterGHExtensionSetupGH (CCTK_RegisterGHExtension ("IOHDF5"), - IOHDF5_SetupGH); } -/****************************************************************************/ -/* local routines */ -/****************************************************************************/ +/******************************************************************** + ******************** Internal Routines ************************ + ********************************************************************/ /*@@ - @routine IOHDF5_SetupGH - @date Mon Jun 19 2000 - @author Thomas Radke + @routine IOHDF5_SetupGH + @date Mon Jun 19 2000 + @author Thomas Radke @desc - Allocates and sets up IOHDF5's GH extension structure. + Allocates and sets up IOHDF5's GH extension structure. @enddesc - @calls CCTK_RegisterIOMethod - CCTK_RegisterIOMethodOutputGH - CCTK_RegisterIOMethodOutputVarAs - CCTK_RegisterIOMethodTimeToOutput - CCTK_RegisterIOMethodTriggerOutput - CCTK_TimerCreate - CCTK_TimerDestroyI - CCTK_TimerResetI - IOUtil_CreateDirectory - - @var config - @vdesc the CCTK configuration as provided by the flesh - @vtype tFleshConfig * - @vio usused + @calls CCTK_RegisterIOMethod + CCTK_RegisterIOMethodOutputGH + CCTK_RegisterIOMethodOutputVarAs + CCTK_RegisterIOMethodTimeToOutput + CCTK_RegisterIOMethodTriggerOutput + CCTK_TimerCreate + CCTK_TimerDestroyI + CCTK_TimerResetI + IOUtil_CreateDirectory + + @var config + @vdesc the CCTK configuration as provided by the flesh + @vtype tFleshConfig * + @vio usused @endvar - @var convergence_level - @vdesc the convergence level - @vtype int - @vio unused + @var convergence_level + @vdesc the convergence level + @vtype int + @vio unused @endvar - @var GH - @vdesc Pointer to CCTK grid hierarchy - @vtype cGH * - @vio in + @var GH + @vdesc Pointer to CCTK grid hierarchy + @vtype cGH * + @vio in @endvar - @returntype void * + @returntype void * @returndesc - pointer to the allocated GH extension structure + pointer to the new GH extension structure @endreturndesc @@*/ static void *IOHDF5_SetupGH (tFleshConfig *config, int convergence_level, cGH *GH) { - DECLARE_CCTK_PARAMETERS - int i; - int numvars; - ioGH *ioUtilGH; + int i, numvars; ioHDF5GH *myGH; + const ioGH *ioUtilGH; const char *timer_names[4] = {"IOHDF5 time to dump parameters", "IOHDF5 time to dump variables", "IOHDF5 total time to checkpoint", "IOHDF5 time to recover"}; - + DECLARE_CCTK_PARAMETERS + /* suppress compiler warnings about unused variables */ - config = config; - convergence_level = convergence_level; + (void) (config + 0); + (void) (convergence_level + 0); /* Register the IOHDF5 routines as a new IO method */ i = CCTK_RegisterIOMethod ("IOHDF5"); @@ -126,12 +134,13 @@ static void *IOHDF5_SetupGH (tFleshConfig *config, CCTK_RegisterIOMethodTimeToOutput (i, IOHDF5_TimeFor); CCTK_RegisterIOMethodTriggerOutput (i, IOHDF5_TriggerOutput); - /* Register the IOHDF5 recovery routine to thorn IOUtil */ + /* Register the IOHDF5 recovery routine with thorn IOUtil */ if (IOUtil_RegisterRecover ("IOHDF5 recovery", IOHDF5_Recover) < 0) { CCTK_WARN (1, "Failed to register IOHDF5 recovery routine"); } + /* allocate a new GH extension structure */ numvars = CCTK_NumVars (); myGH = (ioHDF5GH *) malloc (sizeof (ioHDF5GH)); myGH->out_last = (int *) malloc (numvars * sizeof (int)); @@ -169,7 +178,7 @@ static void *IOHDF5_SetupGH (tFleshConfig *config, } /* Create the output directory */ - ioUtilGH = (ioGH *) CCTK_GHExtension (GH, "IO"); + ioUtilGH = (const ioGH *) CCTK_GHExtension (GH, "IO"); i = IOUtil_CreateDirectory (GH, myGH->outdir, ! CCTK_Equals (out3D_mode, "onefile"), ioUtilGH->ioproc); @@ -184,7 +193,7 @@ static void *IOHDF5_SetupGH (tFleshConfig *config, "HDF5 output directory '%s' already exists", myGH->outdir); } - for (i = 0; i < numvars; i++) + for (i = 0; i < numvars; i++) { myGH->out_last [i] = -1; } @@ -211,7 +220,7 @@ static void *IOHDF5_SetupGH (tFleshConfig *config, CCTK_TimerDestroyI (myGH->timers[i]); } myGH->print_timing_info = 0; - } + } else { CCTK_TimerResetI (myGH->timers[CP_TOTAL_TIMER]); diff --git a/src/Write.c b/src/Write.c index 859214a..8eea1bc 100644 --- a/src/Write.c +++ b/src/Write.c @@ -31,7 +31,6 @@ CCTK_FILEVERSION(AlphaThorns_IOHDF5_Write_c) ********************************************************************/ static char *IOHDF5_GetFilename (const cGH *GH, int vindex, - const ioHDF5Geo_t *slab, const char *name, int *is_new_file); @@ -76,12 +75,11 @@ int IOHDF5_Write (const cGH *GH, int vindex, const char *alias) ioHDF5GH *myGH; hid_t file, plist; int is_new_file; - char *filename; - char *fullname; + char *filename, *fullname; DECLARE_CCTK_PARAMETERS - /* Get the handle for IO extensions */ + /* Get the handles for IO and IOHDF5 extensions */ ioUtilGH = (ioGH *) CCTK_GHExtension (GH, "IO"); myGH = (ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5"); @@ -96,8 +94,7 @@ int IOHDF5_Write (const cGH *GH, int vindex, const char *alias) } /* get the filename for output */ - filename = IOHDF5_GetFilename (GH, vindex, myGH->out_geo[vindex], - alias, &is_new_file); + filename = IOHDF5_GetFilename (GH, vindex, alias, &is_new_file); if (! filename) { fullname = CCTK_FullName (vindex); @@ -162,8 +159,7 @@ int IOHDF5_Write (const cGH *GH, int vindex, const char *alias) specific to any dataset goes into dedicated groups */ if (strcmp (out3D_parameters, "no")) { - IOHDF5Util_DumpParameters (GH, strcmp (out3D_parameters, "all") == 0, - file); + IOHDF5Util_DumpParameters (GH, ! strcmp (out3D_parameters, "all"), file); } IOHDF5Util_DumpGHExtensions (GH, file); @@ -198,7 +194,8 @@ int IOHDF5_Write (const cGH *GH, int vindex, const char *alias) @routine IOHDF5_GetFilename @author Paul Walker @date Feb 1997 - @desc Builds the filename for output. + @desc + Builds the filename for output. The names of all output files are stored in the filename database. The routine first searches in this database if there is already @@ -207,6 +204,7 @@ int IOHDF5_Write (const cGH *GH, int vindex, const char *alias) database. Generalized for Hyperslab extraction (GL) @enddesc + @var GH @vdesc Pointer to CCTK GH @vtype const cGH * @@ -217,11 +215,6 @@ int IOHDF5_Write (const cGH *GH, int vindex, const char *alias) @vtype int @vio in @endvar - @var slab - @vdesc pointer to hyperslab structure - @vtype const ioHDF5Geo_t * - @vio in - @endvar @var varname @vdesc alias name of variable to output @vtype const char * @@ -240,67 +233,26 @@ int IOHDF5_Write (const cGH *GH, int vindex, const char *alias) @@*/ static char *IOHDF5_GetFilename (const cGH *GH, int vindex, - const ioHDF5Geo_t *slab, const char *varname, int *is_new_file) { - const ioGH *ioUtilGH; /* handle for IOUtil extensions */ - ioHDF5GH *myGH; /* handle for IOHDF5 extensions */ - const ioHDF5UtilGH *h5UtilGH; /* handle for IOHDF5Util extensions */ - const pGH *pughGH; /* handle for PUGH extensions */ - int myproc; + const ioGH *ioUtilGH; + ioHDF5GH *myGH; + const pGH *pughGH; + int myproc, result; /* FIXME: make these strings dynamic */ - char extra[256]; /* Extra stuff in fname based on mode */ - char extradir[256]; /* Extra stuff for an output dir */ - char *filename; /* the return value */ - int result; - char *outputdir, *fullname; + char extra[256], extradir[256]; + char *filename, *outputdir, *fullname, *tmp; ioAdvertisedFileDesc advertised_file; -#if 0 - int idim; - char *extrageo; /* Extra stuff for geometry information */ -#endif - char name[128]; DECLARE_CCTK_PARAMETERS - /* get GH extensions for PUGH, IOUtil, IOHDF5Util, and IOHDF5 */ + /* get GH extensions for PUGH, IOUtil, and IOHDF5 */ pughGH = (const pGH *) PUGH_pGH (GH); ioUtilGH = (const ioGH *) CCTK_GHExtension (GH, "IO"); myGH = (ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5"); - h5UtilGH = (const ioHDF5UtilGH *) CCTK_GHExtension (GH, "IOHDF5Util"); - -#if 0 - /*** FIXME: use new filenaming scheme ***/ - /* To identify the slab in a volume (if sdim<vdim) - build a string like: "012" (3d volume, spanned by xyz) - or "12" (2d volume, spanned by yz(!) and append this to the name: - You get something like this: phi_s12_3d */ - if (slab->sdim<slab->vdim) { - extrageo = (char*) malloc((slab->sdim+1)*sizeof(char)); - sprintf(extrageo,"%d",slab->direction[0]); - for (idim=1;idim<slab->sdim;idim++) - sprintf(extrageo,"%s%d",extrageo,slab->direction[idim]); - sprintf(name,"%s_s%s_%dd",varname,extrageo,slab->vdim); - free(extrageo); - } - /* If sdim==vdim, make it simple: e.g. phi_3d */ - else if (slab->sdim==slab->vdim) - { - sprintf(name,"%s_%dd",varname,slab->vdim); - } - else { - CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Inconsitent dimensions for >%s<: slab (%dD), variable (%dD)\n", - varname, slab->sdim,slab->vdim); - return(NULL); - } -#else - slab = slab; - strcpy (name, varname); -#endif - filename = (char *) GetNamedData (myGH->open_output_files, name); + filename = (char *) GetNamedData (myGH->open_output_files, varname); if (filename != NULL) { /* set flag to indicate that file should be opened in append mode */ @@ -315,15 +267,17 @@ static char *IOHDF5_GetFilename (const cGH *GH, if (out3D_septimefiles) { - char *tmp = extra; - + tmp = extra; sprintf (extra, "%s.time_%7.3f", extra, GH->cctk_time); /* And be sure to replace any spaces in the filename with an _ */ do + { if (*tmp == ' ') + { *tmp = '_'; - while (*++tmp); + } + } while (*++tmp); } @@ -335,22 +289,21 @@ static char *IOHDF5_GetFilename (const cGH *GH, * a directory is created for each output variable to hold the multiple * files. */ - if (! ioUtilGH->unchunked && ioUtilGH->ioproc_every < CCTK_nProcs (GH)) { /* Add the output processor number to the extra string */ sprintf (extra, "%s.file_%d", extra, myproc / ioUtilGH->ioproc_every); /* If necessary create the output directory */ - outputdir = (char *) malloc (strlen (myGH->outdir) + strlen (name) + 5); + outputdir = (char *) malloc (strlen (myGH->outdir) + strlen (varname) + 5); if (strcmp (myGH->outdir, ".")) { - sprintf (outputdir, "%s/%s_3d", myGH->outdir, name); + sprintf (outputdir, "%s/%s_3d", myGH->outdir, varname); } else { - sprintf (outputdir, "%s_3d", name); + sprintf (outputdir, "%s_3d", varname); } result = IOUtil_CreateDirectory (GH, outputdir, @@ -375,27 +328,27 @@ static char *IOHDF5_GetFilename (const cGH *GH, #endif /* extradir is the relative output directory */ - sprintf (extradir, "%s_3d/", name); + sprintf (extradir, "%s_3d/", varname); } /* CREATE THE COMPLETE OUTPUT FILENAME ----------------------------------- */ filename = (char *) malloc (strlen (myGH->outdir) + strlen (extradir) + - strlen (name) + + strlen (varname) + strlen (extra) + (pughGH->identity_string ? strlen (pughGH->identity_string) : 0) + 8); if (strcmp (myGH->outdir, ".")) { sprintf (filename, "%s/%s%s%s%s.h5", - myGH->outdir, extradir, name, extra, + myGH->outdir, extradir, varname, extra, (pughGH->identity_string ? pughGH->identity_string : "")); } else { sprintf (filename, "%s%s%s%s.h5", - extradir, name, extra, + extradir, varname, extra, (pughGH->identity_string ? pughGH->identity_string : "")); } @@ -406,10 +359,10 @@ static char *IOHDF5_GetFilename (const cGH *GH, { if (ioUtilGH->recovered) { - IOHDF5_ERROR (H5Eset_auto (NULL, NULL)); - *is_new_file = H5Fis_hdf5 (filename) <= 0; - IOHDF5_ERROR (H5Eset_auto (h5UtilGH->print_error_fn, - h5UtilGH->print_error_fn_arg)); + H5E_BEGIN_TRY + { + *is_new_file = H5Fis_hdf5 (filename) <= 0; + } H5E_END_TRY; if (! *is_new_file) { myGH->check_exisiting_objects[vindex] = 1; @@ -420,7 +373,7 @@ static char *IOHDF5_GetFilename (const cGH *GH, *is_new_file = 1; } } - StoreNamedData (&myGH->open_output_files, name, filename); + StoreNamedData (&myGH->open_output_files, varname, filename); } else { |