1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/*@@
@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 <string.h>
#include "StoreNamedData.h"
#include "IEEEIO/IOProtos.h"
#include "IEEEIO/IEEEIO.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 {
/* The number of times output */
int *IO_2Dnum;
int *IO_3Dnum;
/* The last iteration output */
int *IO_2Dlast;
int *IO_3Dlast;
/* IEEEIO file name and pointer for 3D output */
char **IEEEfname_3D;
IOFile *IEEEfile_3D;
/* reuse filehandles during IEEEIO */
int reuse_fh;
/* filename database for opened files */
pNamedData *filenameList2D;
pNamedData *fileList_3D;
} 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);
|