From 85b4834743c80a9fcb06b52a6df7a563dfde885c Mon Sep 17 00:00:00 2001 From: tradke Date: Wed, 29 Nov 2000 01:20:44 +0000 Subject: Renamed local variable 'index' into 'vindex' to stop compiler warnings about hiding a global routine index(3). git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5/trunk@32 4825ed28-b72c-4eae-9704-e50c059e567d --- src/DumpGH.c | 5 +++- src/Output.c | 72 ++++++++++++++++++--------------------------------------- src/RecoverGH.c | 3 ++- src/Startup.c | 30 ++++-------------------- src/Write.c | 47 +++++++++++++++++++++---------------- src/ioHDF5GH.h | 7 ++---- 6 files changed, 63 insertions(+), 101 deletions(-) diff --git a/src/DumpGH.c b/src/DumpGH.c index 7c3aee5..a2bf5b6 100644 --- a/src/DumpGH.c +++ b/src/DumpGH.c @@ -26,7 +26,10 @@ static char *rcsid = "$Id$"; CCTK_FILEVERSION(AlphaThorns_IOHDF5_DumpGH_c) -/* local function prototypes */ +/* prototypes of routines defined in this source file */ +void IOHDF5_InitialDataCheckpoint (cGH *GH); +void IOHDF5_EvolutionCheckpoint (cGH *GH); +void IOHDF5_TerminationCheckpoint (cGH *GH); static int IOHDF5_Checkpoint (cGH *GH, int called_from); diff --git a/src/Output.c b/src/Output.c index 418a5f0..50749d6 100644 --- a/src/Output.c +++ b/src/Output.c @@ -20,8 +20,8 @@ static char *rcsid = "$Id$"; CCTK_FILEVERSION(AlphaThorns_IOHDF5_Output_c) -/* function prototypes */ -int IOHDF5_TimeFor (cGH *GH, int index); +/* prototypes of routines defined in this source file */ +int IOHDF5_TimeFor (cGH *GH, int vindex); int IOHDF5_OutputVarAs (cGH *GH, const char *var, const char *alias); static void CheckSteerableParameters (ioHDF5GH *myGH); @@ -46,7 +46,7 @@ static void CheckSteerableParameters (ioHDF5GH *myGH); int IOHDF5_OutputGH (cGH *GH) { DECLARE_CCTK_PARAMETERS - int index; + int vindex; ioHDF5GH *myGH; const char *name; char *fullname; @@ -63,13 +63,13 @@ int IOHDF5_OutputGH (cGH *GH) } /* Loop over all variables */ - for (index = 0; index < CCTK_NumVars (); index++) + for (vindex = 0; vindex < CCTK_NumVars (); vindex++) { - if (IOHDF5_TimeFor (GH, index)) + if (IOHDF5_TimeFor (GH, vindex)) { - name = CCTK_VarName (index); - fullname = CCTK_FullName (index); + name = CCTK_VarName (vindex); + fullname = CCTK_FullName (vindex); if (verbose) { @@ -82,7 +82,7 @@ int IOHDF5_OutputGH (cGH *GH) free (fullname); /* Register variable as having output this iteration */ - myGH->out_last[index] = GH->cctk_iteration; + myGH->out_last[vindex] = GH->cctk_iteration; } } @@ -121,17 +121,17 @@ int IOHDF5_OutputGH (cGH *GH) int IOHDF5_OutputVarAs (cGH *GH, const char *fullname, const char *alias) { DECLARE_CCTK_PARAMETERS - int index; + int vindex; - index = CCTK_VarIndex (fullname); + vindex = CCTK_VarIndex (fullname); if (verbose) CCTK_VInfo (CCTK_THORNSTRING, "IOHDF5_OutputVarAs: fullname, alias, " - "index = (%s, %s, %d)", fullname, alias, index); + "index = (%s, %s, %d)", fullname, alias, vindex); /* Do the output */ - IOHDF5_Write (GH, index, alias); + IOHDF5_Write (GH, vindex, alias); return (0); } @@ -153,7 +153,7 @@ int IOHDF5_OutputVarAs (cGH *GH, const char *fullname, const char *alias) @vtype cGH * @vio in @endvar - @var index + @var vindex @vdesc index of variable @vtype int @vio in @@ -165,7 +165,7 @@ int IOHDF5_OutputVarAs (cGH *GH, const char *fullname, const char *alias) 0 if not @endreturndesc @@*/ -int IOHDF5_TimeFor (cGH *GH, int index) +int IOHDF5_TimeFor (cGH *GH, int vindex) { ioHDF5GH *myGH; @@ -182,13 +182,13 @@ int IOHDF5_TimeFor (cGH *GH, int index) } /* Check this variable should be output */ - if (! (myGH->do_output[index] && GH->cctk_iteration % myGH->out_every == 0)) + if (! (myGH->out_geo[vindex] && GH->cctk_iteration % myGH->out_every == 0)) { return (0); } /* Check variable not already output this iteration */ - if (myGH->out_last[index] == GH->cctk_iteration) + if (myGH->out_last[vindex] == GH->cctk_iteration) { CCTK_WARN (2, "Already done output in IOHDF5"); return (0); @@ -213,13 +213,13 @@ int IOHDF5_TimeFor (cGH *GH, int index) @vtype cGH * @vio in @endvar - @var index + @var vindex @vdesc index of variable @vtype int @vio in @endvar @@*/ -int IOHDF5_TriggerOutput (cGH *GH, int index) +int IOHDF5_TriggerOutput (cGH *GH, int vindex) { DECLARE_CCTK_PARAMETERS ioHDF5GH *myGH; @@ -227,13 +227,13 @@ int IOHDF5_TriggerOutput (cGH *GH, int index) const char *varname; - varname = CCTK_VarName (index); + varname = CCTK_VarName (vindex); myGH = (ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5"); if (verbose) { - fullname = CCTK_FullName (index); + fullname = CCTK_FullName (vindex); CCTK_VInfo (CCTK_THORNSTRING, "IOHDF5_TriggerOutput: " "output of (varname, fullname) " "= ('%s', '%s')", varname, fullname); @@ -241,10 +241,10 @@ int IOHDF5_TriggerOutput (cGH *GH, int index) } /* Do the output */ - IOHDF5_Write (GH, index, varname); + IOHDF5_Write (GH, vindex, varname); /* Register variable as having output this iteration */ - myGH->out_last[index] = GH->cctk_iteration; + myGH->out_last[vindex] = GH->cctk_iteration; return (0); } @@ -288,35 +288,9 @@ static void CheckSteerableParameters (ioHDF5GH *myGH) times_set = CCTK_ParameterQueryTimesSet ("out_vars", CCTK_THORNSTRING); if (times_set != out_vars_lastset) { - IOHDF5Util_ParseVarsForOutput (out_vars, myGH->do_output, myGH->out_geo); - -#if 0 - FIXME: replace this with real parsing routine - memset (myGH->do_output, 0, CCTK_NumVars ()); - CCTK_TraverseString (out_vars, SetOutputFlag, myGH->do_output, - CCTK_GROUP_OR_VAR); -#endif + IOHDF5Util_ParseVarsForOutput (out_vars, myGH->out_geo); /* Save the last setting of 'out_vars' parameter */ out_vars_lastset = times_set; } } - - -#if 0 -/* callback for CCTK_TraverseString() to set the output flag - for the given variable */ -static void SetOutputFlag (int index, const char *optstring, void *arg) -{ - char *flags = (char *) arg; - - - flags[index] = 1; - - if (optstring) - { - CCTK_VWarn (5, __LINE__, __FILE__, CCTK_THORNSTRING, - "Optional string '%s' in variable name ignored", optstring); - } -} -#endif diff --git a/src/RecoverGH.c b/src/RecoverGH.c index bc5d849..2066b40 100644 --- a/src/RecoverGH.c +++ b/src/RecoverGH.c @@ -29,7 +29,8 @@ static char *rcsid = "$Id$"; CCTK_FILEVERSION(CactusPUGHIO_IOHDF5_RecoverGH_c) -/* local function prototypes */ +/* prototypes of routines defined in this source file */ +int IOHDF5_RecoverParameters (void); static int IOHDF5_OpenFile (cGH *GH, const char *basename, int called_from, diff --git a/src/Startup.c b/src/Startup.c index d7b60b5..de7cc84 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -107,6 +107,10 @@ static void *IOHDF5_SetupGH (tFleshConfig *config, ioHDF5GH *myGH; + /* suppress compiler warnings about unused variables */ + config = config; + convergence_level = convergence_level; + /* Register the IOHDF5 routines as a new IO method */ i = CCTK_RegisterIOMethod ("IOHDF5"); CCTK_RegisterIOMethodOutputGH (i, IOHDF5_OutputGH); @@ -122,9 +126,8 @@ static void *IOHDF5_SetupGH (tFleshConfig *config, numvars = CCTK_NumVars (); myGH = (ioHDF5GH *) malloc (sizeof (ioHDF5GH)); - myGH->do_output = (char *) malloc (numvars * sizeof (char)); myGH->out_last = (int *) malloc (numvars * sizeof (int)); - myGH->out_geo = (ioHDF5Geo_t *) malloc (numvars * sizeof (ioHDF5Geo_t)); + myGH->out_geo = (ioHDF5Geo_t **) calloc (numvars, sizeof (ioHDF5Geo_t *)); myGH->check_exisiting_objects = (char *) calloc (numvars, 1); myGH->cp_filename_list = (char **) calloc (checkpoint_keep, sizeof (char *)); myGH->cp_filename_index = 0; @@ -193,26 +196,3 @@ static void *IOHDF5_SetupGH (tFleshConfig *config, return (myGH); } - - -#if 0 -FIXME: is this code still needed ?? -void SliceCenterSetup (cGH *GH) -{ - DECLARE_CCTK_PARAMETERS - int i; - ioHDF5Geo_t geo_default; - ioHDF5GH *myGH; - - - myGH = (ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5"); - - IOHDF5Util_DefaultGeo (&geo_default); - - /* Set the default HDF5 slab geometry for slab with dimension -idim-*/ - for (i = 0; i < CCTK_NumVars (); i++) - { - myGH->out_geo[i] = geo_default; - } -} -#endif diff --git a/src/Write.c b/src/Write.c index c160321..a0c8d2d 100644 --- a/src/Write.c +++ b/src/Write.c @@ -24,12 +24,12 @@ static char *rcsid = "$Id$"; CCTK_FILEVERSION(AlphaThorns_IOHDF5_Write_c) -/* local function prototypes */ +/* prototypes of routines defined in this source file */ static char *IOHDF5_GetFilename (cGH *GH, - int index, - ioHDF5Geo_t *slab, - const char *name, - int *is_new_file); + int vindex, + ioHDF5Geo_t *slab, + const char *name, + int *is_new_file); /*@@ @@ -48,7 +48,7 @@ static char *IOHDF5_GetFilename (cGH *GH, @vtype cGH * @vio in @endvar - @var index + @var vindex @vdesc index of variable @vtype int @vio in @@ -60,7 +60,7 @@ static char *IOHDF5_GetFilename (cGH *GH, @endvar @@*/ void IOHDF5_Write (cGH *GH, - int index, + int vindex, const char *alias) { DECLARE_CCTK_PARAMETERS @@ -78,9 +78,9 @@ void IOHDF5_Write (cGH *GH, myGH = (ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5"); /* check if variable has storage assigned */ - if (! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (index))) + if (! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (vindex))) { - fullname = CCTK_FullName (index); + fullname = CCTK_FullName (vindex); CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, "No IOHDF5 output for '%s' (no storage)", fullname); free (fullname); @@ -88,11 +88,11 @@ void IOHDF5_Write (cGH *GH, } /* get the filename for output */ - filename = IOHDF5_GetFilename (GH, index, &myGH->out_geo[index], - alias, &is_new_file); + filename = IOHDF5_GetFilename (GH, vindex, myGH->out_geo[vindex], + alias, &is_new_file); if (! filename) { - fullname = CCTK_FullName (index); + fullname = CCTK_FullName (vindex); CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, "Unable to construct file name for '%s'", fullname); free (fullname); @@ -142,7 +142,7 @@ void IOHDF5_Write (cGH *GH, } /* get the current timelevel */ - timelevel = CCTK_NumTimeLevelsFromVarI (index) - 1; + timelevel = CCTK_NumTimeLevelsFromVarI (vindex) - 1; if (timelevel > 0) { timelevel--; @@ -162,8 +162,8 @@ void IOHDF5_Write (cGH *GH, } /* output the data */ - IOHDF5Util_DumpVar (GH, index, timelevel, &myGH->out_geo[index], file, - myGH->check_exisiting_objects[index]); + IOHDF5Util_DumpVar (GH, vindex, timelevel, myGH->out_geo[vindex], file, + myGH->check_exisiting_objects[vindex]); /* close the file */ if (file >= 0) @@ -202,7 +202,7 @@ void IOHDF5_Write (cGH *GH, @vtype cGH * @vio in @endvar - @var index + @var vindex @vdesc index of variable to output @vtype int @vio in @@ -229,7 +229,7 @@ void IOHDF5_Write (cGH *GH, @endreturndesc @@*/ static char *IOHDF5_GetFilename (cGH *GH, - int index, + int vindex, ioHDF5Geo_t *slab, const char *varname, int *is_new_file) @@ -243,11 +243,13 @@ static char *IOHDF5_GetFilename (cGH *GH, /* 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 *extrageo; /* Extra stuff for geometry information */ char *filename; /* the return value */ int result; char *outputdir; +#if 0 int idim; + char *extrageo; /* Extra stuff for geometry information */ +#endif char name[128]; @@ -257,6 +259,8 @@ static char *IOHDF5_GetFilename (cGH *GH, myGH = (ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5"); h5UtilGH = (ioHDF5UtilGH *) CCTK_GHExtension (GH, "IOHDF5Util"); +#if 0 + /*** FIXME: use new filenaming scheme ***/ /* To identify the slab in a volume (if sdimsdim,slab->vdim); return(NULL); } +#else + strcpy (name, varname); +#endif filename = (char *) GetNamedData (myGH->open_output_files, name); if (filename != NULL) @@ -294,7 +301,7 @@ static char *IOHDF5_GetFilename (cGH *GH, myproc = CCTK_MyProc (GH); - if (out2D_septimefiles) + if (out3D_septimefiles) { char *tmp = extra; @@ -379,7 +386,7 @@ static char *IOHDF5_GetFilename (cGH *GH, h5UtilGH->print_error_fn_arg)); if (! *is_new_file) { - myGH->check_exisiting_objects[index] = 1; + myGH->check_exisiting_objects[vindex] = 1; } } else diff --git a/src/ioHDF5GH.h b/src/ioHDF5GH.h index 5aa5926..dd1c921 100644 --- a/src/ioHDF5GH.h +++ b/src/ioHDF5GH.h @@ -20,9 +20,6 @@ typedef struct /* how often to output */ int out_every; - /* flags indicating output for var [i] */ - char *do_output; - /* directories in which to output */ char *outdir; @@ -43,7 +40,7 @@ typedef struct int print_timing_info; /* geometry information (downsampling, zooming, etc.) */ - ioHDF5Geo_t *out_geo; + ioHDF5Geo_t **out_geo; /* ring buffer for list of successfully created cp files */ int cp_filename_index; @@ -64,7 +61,7 @@ int IOHDF5_OutputVarAs (cGH *GH, const char *var, const char *alias); int IOHDF5_Recover (cGH *GH, const char *basename, int called_from); /* other function prototypes */ -void IOHDF5_Write (cGH *GH, int index, const char *alias); +void IOHDF5_Write (cGH *GH, int vindex, const char *alias); int IOHDF5_WriteIsosurface (cGH *GH, const char *filename, const char *GVname, -- cgit v1.2.3