aboutsummaryrefslogtreecommitdiff
path: root/src/ioHDF5UtilGH.h
diff options
context:
space:
mode:
authortradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668>2001-06-12 22:39:17 +0000
committertradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668>2001-06-12 22:39:17 +0000
commitbb8a2a2e3aacbcf0d2bf515c3db180c763ff3690 (patch)
treebc11b5555638a1160d2b4aa548a652261d144610 /src/ioHDF5UtilGH.h
parent55fbce955242ab0381d3ccee78f6b35e569c1ae3 (diff)
Support I/O for all the fixed-sized CCTK datatypes also.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5Util/trunk@33 7842ec3a-9562-4be5-9c5b-06ba18f2b668
Diffstat (limited to 'src/ioHDF5UtilGH.h')
-rw-r--r--src/ioHDF5UtilGH.h87
1 files changed, 68 insertions, 19 deletions
diff --git a/src/ioHDF5UtilGH.h b/src/ioHDF5UtilGH.h
index a5d1a16..211d999 100644
--- a/src/ioHDF5UtilGH.h
+++ b/src/ioHDF5UtilGH.h
@@ -2,9 +2,10 @@
@header ioHDF5UtilGH.h
@date Fri Oct 6 2000
@author Thomas Radke
- @desc
+ @desc
The GH extensions structure for IOHDF5Util.
- @version $Id$
+ @enddesc
+ @version $Id$
@@*/
#ifndef _IOUTILHDF5_IOUTILHDF5GH_H_
@@ -106,22 +107,67 @@
} while (0)
-/* Mapping off CCTK datatypes to HDF5 datatypes */
-#define IOHDF5_REAL4 H5T_NATIVE_FLOAT
+/***
+ Define the different datatypes used for HDF5 I/O
+ NOTE: the complex datatype is defined dynamically at runtime in Startup.c
+ ***/
+/* char type is easy */
+#define IOHDF5_CHAR H5T_NATIVE_CHAR
+
+/* floating point types are architecture-independent,
+ ie. a float has always 4 bytes, and a double has 8 bytes
+
+ IOHDF5_REAL is used for storing reals of the generic CCTK_REAL type
+ IOHDF5_REALn is used to explicitely store n-byte reals */
+#ifdef CCTK_REAL4
+#define IOHDF5_REAL4 H5T_NATIVE_FLOAT
+#endif
+#ifdef CCTK_REAL8
+#define IOHDF5_REAL8 H5T_NATIVE_DOUBLE
+#endif
+#ifdef CCTK_REAL16
+#define IOHDF5_REAL16 (sizeof (CCTK_REAL16) == sizeof (long double) ? \
+ H5T_NATIVE_LDOUBLE : -1)
+#endif
+
#ifdef CCTK_REAL_PRECISION_16
-#define IOHDF5_REAL H5T_NATIVE_LDOUBLE
+#define IOHDF5_REAL IOHDF5_REAL16
#elif CCTK_REAL_PRECISION_8
-#define IOHDF5_REAL H5T_NATIVE_DOUBLE
+#define IOHDF5_REAL IOHDF5_REAL8
#elif CCTK_REAL_PRECISION_4
-#define IOHDF5_REAL H5T_NATIVE_FLOAT
+#define IOHDF5_REAL IOHDF5_REAL4
#endif
-#define IOHDF5_INT (sizeof (CCTK_INT) == sizeof (int) ? \
- H5T_NATIVE_INT : H5T_NATIVE_SHORT)
-#define IOHDF5_INT4 (sizeof (int) == 4 ? \
- H5T_NATIVE_INT : H5T_NATIVE_SHORT)
-#define IOHDF5_CHAR H5T_NATIVE_CHAR
+
+/* integer types are architecture-dependent:
+ IOHDF5_INT is used for communicating integers of the generic CCTK_INT type
+ IOHDF5_INTn is used to explicitely communicate n-byte integers */
+#ifdef CCTK_INT8
+#define IOHDF5_INT8 (sizeof (CCTK_INT8) == sizeof (int) ? H5T_NATIVE_INT : \
+ sizeof (CCTK_INT8) == sizeof (long) ? H5T_NATIVE_LONG :\
+ sizeof (CCTK_INT8) == sizeof (long long) ? \
+ H5T_NATIVE_LLONG : -1)
+#endif
+
+#ifdef CCTK_INT4
+#define IOHDF5_INT4 (sizeof (CCTK_INT4) == sizeof (int) ? H5T_NATIVE_INT : \
+ sizeof (CCTK_INT4) == sizeof (short) ? \
+ H5T_NATIVE_SHORT : -1)
+#endif
+
+#ifdef CCTK_INT2
+#define IOHDF5_INT2 (sizeof (CCTK_INT2) == sizeof (short) ? \
+ H5T_NATIVE_SHORT : -1)
+#endif
+
+#ifdef CCTK_INTEGER_PRECISION_8
+#define IOHDF5_INT IOHDF5_INT8
+#elif CCTK_INTEGER_PRECISION_4
+#define IOHDF5_INT IOHDF5_INT4
+#elif CCTK_INTEGER_PRECISION_2
+#define IOHDF5_INT IOHDF5_INT2
+#endif
/* Constants to index timers within the timers array */
@@ -137,6 +183,11 @@
#define ALL_PARAMETERS "All Parameters"
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
/* Geometry information structure for output variable */
typedef struct
{
@@ -178,8 +229,10 @@ typedef struct
hid_t scalar_dataspace, array_dataspace;
/* predefined datatype for writing CCTK_COMPLEX types */
- hid_t IOHDF5_COMPLEX;
- hid_t IOHDF5_COMPLEX8;
+ hid_t IOHDF5_COMPLEX,
+ IOHDF5_COMPLEX8,
+ IOHDF5_COMPLEX16,
+ IOHDF5_COMPLEX32;
/* predefined datatype for writing C string string attributes */
hid_t IOHDF5_STRING;
@@ -187,12 +240,8 @@ typedef struct
} ioHDF5UtilGH;
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
/* exported functions */
+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);