diff options
author | tradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668> | 2001-11-05 15:12:03 +0000 |
---|---|---|
committer | tradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668> | 2001-11-05 15:12:03 +0000 |
commit | 4a477a2c7ccf32f0c56a2e1348217ef67bdae0cb (patch) | |
tree | 97bb2f125823efac6e93a24f0afe52e58f1e3126 | |
parent | ce402fb886c3764cb3594fbf1272bab7070de89e (diff) |
Added const qualifier to the 'cGH *' argument of some more IO functions.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5Util/trunk@44 7842ec3a-9562-4be5-9c5b-06ba18f2b668
-rw-r--r-- | src/DumpUtils.c | 36 | ||||
-rw-r--r-- | src/DumpVar.c | 112 | ||||
-rw-r--r-- | src/RecoverVar.c | 8 | ||||
-rw-r--r-- | src/ioHDF5UtilGH.h | 22 |
4 files changed, 105 insertions, 73 deletions
diff --git a/src/DumpUtils.c b/src/DumpUtils.c index 3aaa6b2..d44873c 100644 --- a/src/DumpUtils.c +++ b/src/DumpUtils.c @@ -34,12 +34,12 @@ CCTK_FILEVERSION(BetaThorns_IOHDF5Util_DumpUtils_c) @enddesc @var GH @vdesc Pointer to CCTK grid hierarchy - @vtype cGH * + @vtype const cGH * @vio in @endvar @var timers @vdesc array of timers for timing the checkpointing - @vtype int [] + @vtype const int * @vio in @endvar @var file @@ -53,8 +53,8 @@ CCTK_FILEVERSION(BetaThorns_IOHDF5Util_DumpUtils_c) always 0 (for success) @endreturndesc @@*/ -int IOHDF5Util_DumpGH (cGH *GH, - int timers[], +int IOHDF5Util_DumpGH (const cGH *GH, + const int *timers, hid_t file) { DECLARE_CCTK_PARAMETERS @@ -65,7 +65,15 @@ int IOHDF5Util_DumpGH (cGH *GH, int old_out_single; ioGH *ioUtilGH; ioHDF5Geo_t request; + /*** FIXME: can CCTK_SyncGroup() have a 'const cGH *' parameter ?? ***/ + union + { + const cGH *const_ptr; + cGH *non_const_ptr; + } GH_fake_const; + + GH_fake_const.const_ptr = GH; /* Get the GH extension for IOUtil */ ioUtilGH = (ioGH *) CCTK_GHExtension (GH, "IO"); @@ -93,7 +101,7 @@ int IOHDF5Util_DumpGH (cGH *GH, if (CCTK_IsImplementationActive ( CCTK_ImpFromVarI (CCTK_FirstVarIndexI (vindex)))) { - CCTK_SyncGroupI (GH, vindex); + CCTK_SyncGroupI (GH_fake_const.non_const_ptr, vindex); } } @@ -140,7 +148,7 @@ int IOHDF5Util_DumpGH (cGH *GH, } /* sync the group */ - CCTK_SyncGroupI (GH, gindex); + CCTK_SyncGroupI (GH_fake_const.non_const_ptr, gindex); /* dump all timelevels except the oldest (for multi-level groups) */ CCTK_GroupData (gindex, &gdata); @@ -211,7 +219,7 @@ int IOHDF5Util_DumpGH (cGH *GH, @enddesc @var GH @vdesc Pointer to CCTK grid hierarchy - @vtype cGH * + @vtype const cGH * @vio in @endvar @var vindex @@ -240,11 +248,11 @@ int IOHDF5Util_DumpGH (cGH *GH, @vio in @endvar @@*/ -void IOHDF5Util_DumpCommonAttributes (cGH *GH, +void IOHDF5Util_DumpCommonAttributes (const cGH *GH, int vindex, int timelevel, - CCTK_INT global_shape[], - ioHDF5Geo_t *request, + const CCTK_INT *global_shape, + const ioHDF5Geo_t *request, hid_t dataset) { DECLARE_CCTK_PARAMETERS @@ -352,7 +360,7 @@ void IOHDF5Util_DumpCommonAttributes (cGH *GH, @enddesc @var GH @vdesc Pointer to CCTK grid hierarchy - @vtype cGH * + @vtype const cGH * @vio in @endvar @var file @@ -361,7 +369,7 @@ void IOHDF5Util_DumpCommonAttributes (cGH *GH, @vio in @endvar @@*/ -void IOHDF5Util_DumpParameters (cGH *GH, +void IOHDF5Util_DumpParameters (const cGH *GH, hid_t file) { DECLARE_CCTK_PARAMETERS @@ -404,7 +412,7 @@ void IOHDF5Util_DumpParameters (cGH *GH, @enddesc @var GH @vdesc Pointer to CCTK grid hierarchy - @vtype cGH * + @vtype const cGH * @vio in @endvar @var file @@ -413,7 +421,7 @@ void IOHDF5Util_DumpParameters (cGH *GH, @vio in @endvar @@*/ -void IOHDF5Util_DumpGHExtensions (cGH *GH, +void IOHDF5Util_DumpGHExtensions (const cGH *GH, hid_t file) { DECLARE_CCTK_PARAMETERS diff --git a/src/DumpVar.c b/src/DumpVar.c index 9f31438..a2f9a21 100644 --- a/src/DumpVar.c +++ b/src/DumpVar.c @@ -41,45 +41,45 @@ typedef struct /* prototypes of routines defined in this source file */ -static int IOHDF5Util_DumpGS (cGH *GH, +static int IOHDF5Util_DumpGS (const cGH *GH, int vindex, int timelevel, int iohdf5_type, - ioHDF5Geo_t *request, + const ioHDF5Geo_t *request, int check_exisiting_objects, hid_t file); -static int IOHDF5Util_DumpGA (cGH *GH, +static int IOHDF5Util_DumpGA (const cGH *GH, int vindex, int timelevel, - ioHDF5Geo_t *request, - dumpInfo *info, + const ioHDF5Geo_t *request, + const dumpInfo *info, int check_exisiting_objects, hid_t file); -static int IOHDF5Util_getDumpData (cGH *GH, +static int IOHDF5Util_getDumpData (const cGH *GH, int vindex, int timelevel, - ioHDF5Geo_t *request, + const ioHDF5Geo_t *request, void **outme, int *free_outme, CCTK_INT *geom); -static void IOHDF5Util_procDump (cGH *GH, +static void IOHDF5Util_procDump (const cGH *GH, int vindex, int timelevel, - ioHDF5Geo_t *request, - void *outme, - CCTK_INT *geom, + const ioHDF5Geo_t *request, + const void *outme, + const CCTK_INT *geom, int proc, int iohdf5_type, int check_exisiting_objects, hid_t file); #ifdef CCTK_MPI #ifdef HAVE_PARALLEL -static void IOHDF5Util_collectiveDump (cGH *GH, +static void IOHDF5Util_collectiveDump (const cGH *GH, int vindex, int timelevel, - ioHDF5Geo_t *request, - void *outme, - CCTK_INT *geom, + const ioHDF5Geo_t *request, + const void *outme, + const CCTK_INT *geom, int hdf5io_type, hid_t file); #endif /* HAVE_PARALLEL */ @@ -100,7 +100,7 @@ static void IOHDF5Util_collectiveDump (cGH *GH, @var GH @vdesc Pointer to CCTK grid hierarchy - @vtype cGH * + @vtype const cGH * @vio in @endvar @var vindex @@ -115,7 +115,7 @@ static void IOHDF5Util_collectiveDump (cGH *GH, @endvar @var request @vdesc pointer to the IO request structure - @vtype ioHDF5Geo_t * + @vtype const ioHDF5Geo_t * @vio in @endvar @var file @@ -139,10 +139,10 @@ static void IOHDF5Util_collectiveDump (cGH *GH, @seeroutine IOHDF5Util_DumpGA @endreturndesc @@*/ -int IOHDF5Util_DumpVar (cGH *GH, +int IOHDF5Util_DumpVar (const cGH *GH, int vindex, int timelevel, - ioHDF5Geo_t *request, + const ioHDF5Geo_t *request, hid_t file, int check_exisiting_objects) { @@ -230,7 +230,7 @@ int IOHDF5Util_DumpVar (cGH *GH, @enddesc @var GH @vdesc Pointer to CCTK grid hierarchy - @vtype cGH + @vtype const cGH * @vio in @endvar @var vindex @@ -250,7 +250,7 @@ int IOHDF5Util_DumpVar (cGH *GH, @endvar @var request @vdesc pointer to the IO request structure - @vtype ioHDF5Geo_t * + @vtype const ioHDF5Geo_t * @vio in @endvar @var check_exisiting_objects @@ -271,11 +271,11 @@ int IOHDF5Util_DumpVar (cGH *GH, always 0 @endreturndesc @@*/ -static int IOHDF5Util_DumpGS (cGH *GH, +static int IOHDF5Util_DumpGS (const cGH *GH, int vindex, int timelevel, int iohdf5_type, - ioHDF5Geo_t *request, + const ioHDF5Geo_t *request, int check_exisiting_objects, hid_t file) { @@ -341,7 +341,7 @@ static int IOHDF5Util_DumpGS (cGH *GH, @var GH @vdesc Pointer to CCTK grid hierarchy - @vtype cGH + @vtype const cGH * @vio in @endvar @var vindex @@ -356,7 +356,7 @@ static int IOHDF5Util_DumpGS (cGH *GH, @endvar @var request @vdesc pointer to the IO request structure - @vtype ioHDF5Geo_t * + @vtype const ioHDF5Geo_t * @vio in @endvar @var info @@ -364,7 +364,7 @@ static int IOHDF5Util_DumpGS (cGH *GH, - the HDF5 datatype to store - the size of an element of variable - the MPI datatype to communicate - @vtype dumpInfo + @vtype const dumpInfo * @vio in @endvar @var check_exisiting_objects @@ -386,11 +386,11 @@ static int IOHDF5Util_DumpGS (cGH *GH, or returncode of @seeroutine IOHDF5Util_getDumpData @endreturndesc @@*/ -static int IOHDF5Util_DumpGA (cGH *GH, +static int IOHDF5Util_DumpGA (const cGH *GH, int vindex, int timelevel, - ioHDF5Geo_t *request, - dumpInfo *info, + const ioHDF5Geo_t *request, + const dumpInfo *info, int check_exisiting_objects, hid_t file) { @@ -532,10 +532,10 @@ static int IOHDF5Util_DumpGA (cGH *GH, /**************************************************************************/ /* local functions */ /**************************************************************************/ -static int IOHDF5Util_getDumpData (cGH *GH, +static int IOHDF5Util_getDumpData (const cGH *GH, int vindex, int timelevel, - ioHDF5Geo_t *request, + const ioHDF5Geo_t *request, void **outme, int *free_outme, CCTK_INT *geom) @@ -639,7 +639,7 @@ static int IOHDF5Util_getDumpData (cGH *GH, @var GH @vdesc Pointer to CCTK grid hierarchy - @vtype cGH * + @vtype const cGH * @vio in @endvar @var vindex @@ -652,14 +652,19 @@ static int IOHDF5Util_getDumpData (cGH *GH, @vtype int @vio in @endvar + @var request + @vdesc pointer to the IO request structure + @vtype const ioHDF5Geo_t * + @vio in + @endvar @var outme @vdesc pointer to the chunk to dump - @vtype void * + @vtype const void * @vio in @endvar @var geom @vdesc bounds and sizes of the output - @vtype CCTK_INT[3*dim] + @vtype const CCTK_INT[3*dim] @vio in @vcomment geom[0*dim..1*dim-1]: lower bounds geom[1*dim..2*dim-1]: (local) data sizes @@ -675,18 +680,25 @@ static int IOHDF5Util_getDumpData (cGH *GH, @vtype int @vio in @endvar + @var check_exisiting_objects + @vdesc flag indicating if we should check for already existing objects + before these are created anew + This might happen for existing files reopened after recovery. + @vtype int + @vio in + @endvar @var file @vdesc the HDF5 file handle @vtype hid_t @vio in @endvar @@*/ -static void IOHDF5Util_procDump (cGH *GH, +static void IOHDF5Util_procDump (const cGH *GH, int vindex, int timelevel, - ioHDF5Geo_t *request, - void *outme, - CCTK_INT *geom, + const ioHDF5Geo_t *request, + const void *outme, + const CCTK_INT *geom, int proc, int iohdf5_type, int check_exisiting_objects, @@ -843,7 +855,7 @@ static void IOHDF5Util_procDump (cGH *GH, @var GH @vdesc Pointer to CCTK grid hierarchy - @vtype cGH * + @vtype const cGH * @vio in @endvar @var vindex @@ -856,14 +868,19 @@ static void IOHDF5Util_procDump (cGH *GH, @vtype int @vio in @endvar + @var request + @vdesc pointer to the IO request structure + @vtype const ioHDF5Geo_t * + @vio in + @endvar @var outme @vdesc pointer to the chunk to dump - @vtype void * + @vtype const void * @vio in @endvar @var geom @vdesc bounds and sizes of the output - @vtype CCTK_INT[3*dim] + @vtype const CCTK_INT[3*dim] @vio in @vcomment geom[0*dim..1*dim-1]: lower bounds geom[1*dim..2*dim-1]: (local) data sizes @@ -874,17 +891,24 @@ static void IOHDF5Util_procDump (cGH *GH, @vtype int @vio in @endvar + @var check_exisiting_objects + @vdesc flag indicating if we should check for already existing objects + before these are created anew + This might happen for existing files reopened after recovery. + @vtype int + @vio in + @endvar @var file @vdesc the HDF5 file handle @vtype hid_t @vio in @endvar @@*/ -static void IOHDF5Util_collectiveDump (cGH *GH, +static void IOHDF5Util_collectiveDump (const cGH *GH, int vindex, int timelevel, - ioHDF5Geo_t *request, - void *outme, + const ioHDF5Geo_t *request, + const void *outme, CCTK_INT *geom, int hdf5io_type, hid_t file) diff --git a/src/RecoverVar.c b/src/RecoverVar.c index 0b8781f..852a78e 100644 --- a/src/RecoverVar.c +++ b/src/RecoverVar.c @@ -69,12 +69,12 @@ static herr_t processDataset (hid_t group, @endvar @var fileinfo @vdesc pointer to info structure describing the HDF5 file - @vtype fileinfo_t * + @vtype const fileinfo_t * @vio in @endvar @@*/ int IOHDF5Util_RecoverVariables (cGH *GH, - fileinfo_t *fileinfo) + const fileinfo_t *fileinfo) { DECLARE_CCTK_PARAMETERS #ifdef CCTK_MPI @@ -175,7 +175,7 @@ int IOHDF5Util_RecoverVariables (cGH *GH, sending it in a loop from each IO processor to all the non IOs (don't have subcommunicators yet) */ int IOHDF5Util_RecoverGHextensions (cGH *GH, - fileinfo_t *fileinfo) + const fileinfo_t *fileinfo) { hid_t group; CCTK_REAL4 real4Buffer; @@ -236,7 +236,7 @@ int IOHDF5Util_RecoverGHextensions (cGH *GH, Broadcasting the complete parameter string is found faster than sending it in a loop from each IO processor to all the non IOs (don't have subcommunicators yet) */ -int IOHDF5Util_RecoverParameters (fileinfo_t *fileinfo) +int IOHDF5Util_RecoverParameters (const fileinfo_t *fileinfo) { DECLARE_CCTK_PARAMETERS hid_t group, attr, atype; diff --git a/src/ioHDF5UtilGH.h b/src/ioHDF5UtilGH.h index ed16fb2..ff8984f 100644 --- a/src/ioHDF5UtilGH.h +++ b/src/ioHDF5UtilGH.h @@ -244,26 +244,26 @@ typedef struct hid_t IOHDF5Util_DataType (const ioHDF5UtilGH *myGH, int cctk_type); void IOHDF5Util_ParseVarsForOutput (const char *output_varstring, ioHDF5Geo_t *output_request_list[]); -void IOHDF5Util_DumpParameters (cGH *GH, hid_t group); -void IOHDF5Util_DumpGHExtensions (cGH *GH, hid_t group); -int IOHDF5Util_DumpGH (cGH *GH, int timers[], hid_t file); -void IOHDF5Util_DumpCommonAttributes (cGH *GH, +void IOHDF5Util_DumpParameters (const cGH *GH, hid_t group); +void IOHDF5Util_DumpGHExtensions (const cGH *GH, hid_t group); +int IOHDF5Util_DumpGH (const cGH *GH, const int *timers, hid_t file); +void IOHDF5Util_DumpCommonAttributes (const cGH *GH, int vindex, int timelevel, - CCTK_INT global_shape[], - ioHDF5Geo_t *slab, + const CCTK_INT *global_shape, + const ioHDF5Geo_t *slab, hid_t dataset); -int IOHDF5Util_DumpVar (cGH *GH, +int IOHDF5Util_DumpVar (const cGH *GH, int vindex, int timelevel, - ioHDF5Geo_t *slab, + const ioHDF5Geo_t *slab, hid_t file, int check_exisiting_objects); -int IOHDF5Util_RecoverParameters (fileinfo_t *filenfo); +int IOHDF5Util_RecoverParameters (const fileinfo_t *filenfo); int IOHDF5Util_RecoverGHextensions (cGH *GH, - fileinfo_t *filenfo); + const fileinfo_t *filenfo); int IOHDF5Util_RecoverVariables (cGH *GH, - fileinfo_t *filenfo); + const fileinfo_t *filenfo); #ifdef __cplusplus } // extern "C" |