From b324a78e90cb0353f88a9dcde47d2e5ca27294f0 Mon Sep 17 00:00:00 2001 From: tradke Date: Thu, 27 Jun 2002 12:49:12 +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/IOFlexIO/trunk@259 ebee0441-1374-4afa-a3b5-247f3ba15b9a --- doc/CreateIOFlexIOdatafile.c | 17 ++++++++++++----- doc/documentation.tex | 6 +++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/doc/CreateIOFlexIOdatafile.c b/doc/CreateIOFlexIOdatafile.c index cd14c9c..7ba5059 100644 --- a/doc/CreateIOFlexIOdatafile.c +++ b/doc/CreateIOFlexIOdatafile.c @@ -32,10 +32,13 @@ we didn't include these here. */ #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 a FlexIO call with return code checking in case of an error it will issue an error message and exit */ -#define CHECK_ERROR(flexio_call) \ - do \ +#define CHECK_ERROR(flexio_call) \ { \ int _error_code = flexio_call; \ \ @@ -47,7 +50,7 @@ __LINE__, #flexio_call, _error_code); \ return (-1); \ } \ - } while (0) + } /*@@ @@ -108,7 +111,7 @@ int main (void) /* as a Cactus grid variable */ /**************************************************************************/ - /* the variable's name (as specified in the interface.ccl file) */ + /* the variable's full name (as specified in the interface.ccl file) */ varname = "grid::x"; CHECK_ERROR (IOwriteAttribute (datafile, "name", CHAR, strlen (varname) + 1, varname)); @@ -132,7 +135,7 @@ int main (void) timelevel = 0; CHECK_ERROR (IOwriteAttribute (datafile, "timelevel", INT32, 1, &timelevel)); - /* the dimensions of the variable (must correspond with the grid size + /* the dimensions of the variable (must correspond to the grid size in your parameter file) */ CHECK_ERROR (IOwriteAttribute (datafile, "global_size", INT32, NDIM, dimsI)); @@ -157,6 +160,10 @@ int main (void) CHECK_ERROR (IOwriteAttribute (datafile, "GH$ioproc_every", INT32, 1, &ioproc_every)); + /* the version of Cactus that this datafile is (upwards) compatible with */ + CHECK_ERROR (IOwriteAttribute (datafile, "Cactus version", CHAR, + strlen (CACTUS_VERSION) + 1, CACTUS_VERSION)); + /* close the file and free allocated resources */ CHECK_ERROR (IOclose (datafile)); diff --git a/doc/documentation.tex b/doc/documentation.tex index 5c7f020..5c58725 100644 --- a/doc/documentation.tex +++ b/doc/documentation.tex @@ -238,12 +238,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 attached as attributes to the very first dataset in the file. 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