/*@@ @header IOFlexIOGH.h @date Tue 9th Jan 1999 @author Gabrielle Allen @desc The extensions to the GH structure from IO. @history @hauthor Thomas Radke @hdate 16 Mar 1999 @hdesc Added parameters for 2D and 3D output @hauthor Thomas Radke @hdate 17 Mar 1999 @hdesc Changed naming: IEEEIO -> IOFlexIO @hauthor Thomas Radke @hdate 30 Mar 1999 @hdesc Undefined DI macro @endhistory @version $Header$ @@*/ #include #include "StoreNamedData.h" #include "external/IEEEIO/src/IOProtos.h" #include "external/IEEEIO/src/IEEEIO.h" #include "external/IEEEIO/src/MPIO.h" /* define the IOFlexIO datatypes according to CCTK_??? datatypes */ #define FLEXIO_REAL4 FLOAT32 #ifdef CCTK_REAL_PRECISION_16 #error "128-bit precision floating point types are not supported by IOFlexIO !" #elif CCTK_REAL_PRECISION_8 #define FLEXIO_REAL FLOAT64 #elif CCTK_REAL_PRECISION_4 #define FLEXIO_REAL FLOAT32 #endif #ifdef CCTK_INTEGER_PRECISION_8 #define FLEXIO_INT INT64 #elif CCTK_INTEGER_PRECISION_4 #define FLEXIO_INT INT32 #elif CCTK_INTEGER_PRECISION_2 #define FLEXIO_INT INT16 #endif #define FLEXIO_INT4 INT32 #define FLEXIO_CHAR CHAR /* attribute name for storing parameters Parameters are stored as a single string attached to the very first dataset in an IEEEIO file. */ #define GLOBAL_PARAMETERS "global_parameters" /* Check error flags from IOFlexIO */ #define CACTUS_IEEEIO_ERROR(fn_call) \ do { \ \ int error_code = fn_call; \ \ if (error_code < 0) \ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, \ "IEEEIO call '%s' returned error code %d\n", \ #fn_call, error_code); \ } while (0) /* structure holding necessary information about a recovery file */ typedef struct { int is_IEEEIO_file; /* flag indicating valid file info */ IOFile fid; /* IEEEIO file handle */ char filename [1024]; /* complete file name for recovery */ int nprocs; /* number of total processors */ int ioproc; /* the associated IO processor */ int ioproc_every; /* how many IO processors there are */ int unchunked; /* whether data was written chunked or unchunked */ } fileinfo_t; /* IOFlexIO GH extension structure */ typedef struct IOFlexIOGH { /* flags indicating output for var [i] */ char *do_out2D; char *do_out3D; /* how often to output */ int out2D_every; int out3D_every; /* directory in which to output */ char *outdir2D; char *outdir3D; /* the last iteration output */ int *out2D_last; int *out3D_last; /* IEEEIO file name and pointer for 3D output */ char **IEEEfname_3D; IOFile *IEEEfile_3D; /* filename database for opened files */ pNamedData *filenameList2D; pNamedData *fileList_3D; /* slice point for 2D output */ int sp2xyz [3]; /* handles for different timers */ int dumpVarsTimer; int dumpParamsTimer; int checkpointTotalTimer; int recoverVarsTimer; int recoverParamsTimer; int recoverTotalTimer; } flexioGH; /* function prototypes */ void IOFlexIO_Write2D (cGH *GH, int index, const char *alias); void IOFlexIO_Write3D (cGH *GH, int index, const char *alias); void IOFlexIO_DumpVar (cGH *GH, int index, int timelevel, IOFile iof); void IOFlexIO_IEEEIOStructDump (cGH *GH, IOFile iof); void IOFlexIO_DumpGH (cGH *GH, int called_from);