From f34cce1984aacff122cf24a698c62517e7b4ec4b Mon Sep 17 00:00:00 2001 From: tradke Date: Thu, 27 Jun 2002 12:49:14 +0000 Subject: Add the "Cactus version" attribute to a datafile indicating that variables with multiple timelevels should be read in following the new timelevel scheme. Thanks to Ken Smith for pointing this out. This closes PR Documentation/1107. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5/trunk@145 4825ed28-b72c-4eae-9704-e50c059e567d --- doc/CreateIOHDF5datafile.c | 20 +++++++++++++++----- doc/documentation.tex | 6 +++++- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'doc') diff --git a/doc/CreateIOHDF5datafile.c b/doc/CreateIOHDF5datafile.c index 5e1d597..bb1275c 100644 --- a/doc/CreateIOHDF5datafile.c +++ b/doc/CreateIOHDF5datafile.c @@ -33,10 +33,13 @@ #define GLOBAL_ATTRIBUTES_GROUP "Global Attributes" #define CCTK_GF 2 +/* the Cactus version that this datafile is (upwards) compatible with + (versions below beta10 use a different timelevel scheme) */ +#define CACTUS_VERSION "4.0.b10" + /* a simple macro to do an HDF5 call with return code checking in case of an error it will issue an error message and exit */ #define CHECK_ERROR(hdf5_call) \ - do \ { \ int _error_code = hdf5_call; \ \ @@ -48,7 +51,7 @@ __LINE__, #hdf5_call, _error_code); \ return (-1); \ } \ - } while (0) + } /*@@ @@ -96,6 +99,8 @@ int main (void) we are lazy here and only initialize it to zero */ data = calloc (elements, sizeof (double)); + CHECK_ERROR (stringtype = H5Tcopy (H5T_C_S1)); + /**************************************************************************/ /* create a group with attributes describing how the data in this file */ @@ -127,6 +132,14 @@ int main (void) dataspace, H5P_DEFAULT)); CHECK_ERROR (H5Awrite (attr, H5T_NATIVE_INT, &ioproc_every)); CHECK_ERROR (H5Aclose (attr)); + + /* the version of Cactus that this datafile is (upwards) compatible with */ + CHECK_ERROR (H5Tset_size (stringtype, strlen (CACTUS_VERSION))); + CHECK_ERROR (attr = H5Acreate (dataset, "Cactus version", stringtype, + dataspace, H5P_DEFAULT)); + CHECK_ERROR (H5Awrite (attr, stringtype, CACTUS_VERSION)); + CHECK_ERROR (H5Aclose (attr)); + CHECK_ERROR (H5Gclose (group)); CHECK_ERROR (H5Sclose (dataspace)); @@ -161,9 +174,6 @@ int main (void) /* add the necessary attributes describing the dataset */ /* as a Cactus grid variable */ /**************************************************************************/ - CHECK_ERROR (dataspace = H5Screate (H5S_SCALAR)); - CHECK_ERROR (stringtype = H5Tcopy (H5T_C_S1)); - /* the variable's group name (as specified in the interface.ccl file) */ groupname = "grid::coordinates"; CHECK_ERROR (H5Tset_size (stringtype, strlen (groupname))); diff --git a/doc/documentation.tex b/doc/documentation.tex index d950402..fc0afbc 100644 --- a/doc/documentation.tex +++ b/doc/documentation.tex @@ -220,12 +220,16 @@ template for building your own data converter program.\\ \item Does the file contain chunked or unchunked data ? \item How many processors were used to produce the data ? \item How many I/O processors were used to write the data ? + \item What Cactus version is this datafile compatible with ? \end{itemize} Such information is put into as attributes into a group named {\tt "Global Attributes"}. Since we assume unchunked data here the processor information isn't relevant --- unchunked data can be fed back into a Cactus simulation running on an arbitrary - number of processors. + number of processors.\\ + The Cactus version ID must be present to indicate that grid variables + with multiple timelevels should be recovered following the new + timelevel scheme (as introduced in Cactus beta 10). \end{enumerate} The example C program goes through all of these steps and creates a datafile -- cgit v1.2.3