aboutsummaryrefslogtreecommitdiff
path: root/src/Write.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Write.c')
-rw-r--r--src/Write.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/Write.c b/src/Write.c
index 56b4bc5..addd5a0 100644
--- a/src/Write.c
+++ b/src/Write.c
@@ -2,9 +2,9 @@
@file Write.c
@date Tue Oct 10 2000
@author Thomas Radke
- @desc
+ @desc
File handling routines for IOStreamedHDF5.
- @enddesc
+ @enddesc
@version $Id$
@@*/
@@ -52,25 +52,23 @@ CCTK_FILEVERSION(BetaThorns_IOStreamedHDF5_Write_c)
@returntype int
@returndesc
- 0 for success, or<BR>
+ return code of @seeroutine IOHDF5Util_DumpVar, or<BR>
-1 if variable has no storage assigned
@endreturndesc
@@*/
int IOStreamedHDF5_Write (const cGH *GH, int vindex, const char *alias)
{
- DECLARE_CCTK_PARAMETERS
- int old_ioproc;
- int old_nioprocs;
- int old_ioproc_every;
+ int old_ioproc, old_nioprocs, old_ioproc_every, retval;
char *fullname;
ioGH *ioUtilGH;
ioStreamedHDF5GH *myGH;
hid_t file, plist;
H5FD_stream_fapl_t fapl;
+ DECLARE_CCTK_PARAMETERS
/* suppress compiler warnings about unused variables */
- alias = alias;
+ (void) (alias + 0);
/* first, check if variable has storage assigned */
if (! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (vindex)))
@@ -82,11 +80,10 @@ int IOStreamedHDF5_Write (const cGH *GH, int vindex, const char *alias)
return (-1);
}
- /* Get the handles for IO and IOStreamedHDF5 extensions */
ioUtilGH = (ioGH *) CCTK_GHExtension (GH, "IO");
myGH = (ioStreamedHDF5GH *) CCTK_GHExtension (GH, "IOStreamedHDF5");
- /* for now we can only have IO mode "oneproc" */
+ /* for now we can only have I/O mode "oneproc" */
if (ioUtilGH->nioprocs != 1)
{
CCTK_WARN (2, "Output into multiple chunked files not yet implemented. "
@@ -117,18 +114,18 @@ int IOStreamedHDF5_Write (const cGH *GH, int vindex, const char *alias)
fapl.broadcast_fn = NULL;
fapl.broadcast_arg = NULL;
- IOHDF5_ERROR (plist = H5Pcreate (H5P_FILE_ACCESS));
- IOHDF5_ERROR (H5Pset_fapl_stream (plist, &fapl));
+ HDF5_ERROR (plist = H5Pcreate (H5P_FILE_ACCESS));
+ HDF5_ERROR (H5Pset_fapl_stream (plist, &fapl));
/* filename is not used if we pass a plist
but it must not be NULL or an empty string */
- IOHDF5_ERROR (file = H5Fcreate ("unused", H5F_ACC_TRUNC, H5P_DEFAULT,
+ HDF5_ERROR (file = H5Fcreate ("unused", H5F_ACC_TRUNC, H5P_DEFAULT,
plist));
- IOHDF5_ERROR (H5Pclose (plist));
+ HDF5_ERROR (H5Pclose (plist));
}
/* output the data */
- IOHDF5Util_DumpVar (GH, vindex, 0, myGH->geo_output[vindex], file, 0);
+ retval = IOHDF5Util_DumpVar (GH, myGH->slablist[vindex], file);
/* close the file */
if (file >= 0)
@@ -137,7 +134,7 @@ int IOStreamedHDF5_Write (const cGH *GH, int vindex, const char *alias)
{
CCTK_INFO ("Closing HDF5 output file from this iteration");
}
- IOHDF5_ERROR (H5Fclose (file));
+ HDF5_ERROR (H5Fclose (file));
}
/* restore original IO mode */
@@ -145,5 +142,5 @@ int IOStreamedHDF5_Write (const cGH *GH, int vindex, const char *alias)
ioUtilGH->nioprocs = old_nioprocs;
ioUtilGH->ioproc_every = old_ioproc_every;
- return (0);
+ return (retval);
}