/*@@ @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 /* Check error flags from IOFlexIO */ #define CACTUS_IEEEIO_ERROR(fn_call) \ do { \ \ int error_code = fn_call; \ \ if (error_code < 0) { \ char *msg = (char*) malloc(strlen(__FILE__) + strlen(#fn_call) + 160);\ \ sprintf (msg, \ "IEEEIO call %s returned error code %d, file %s, line %d\n", \ #fn_call, error_code, __FILE__, __LINE__); \ CCTK_WARN (1, msg); \ free (msg); \ } \ } while (0) 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; /* reuse filehandles during IEEEIO */ int out3d_reuse_filehandles; /* filename database for opened files */ pNamedData *filenameList2D; pNamedData *fileList_3D; /* slice point for 2D output */ int sp2xyz [3]; } 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);