aboutsummaryrefslogtreecommitdiff
path: root/src/ioutil_Utils.h
blob: 655ee7d0867c605de354db5c4dbbfa85a88d2e78 (plain)
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
97
98
99
100
101
102
103
104
105
106
107
108
 /*@@
   @header    ioutil_Utils.h
   @date      Tue 19 Sep 2000
   @author    Thomas Radke
   @desc
              Function prototypes for setting up slice centers.
   @enddesc
   @version   $Header$
 @@*/

#ifndef _IOUTIL_IOUTIL_UTILS_H_
#define _IOUTIL_IOUTIL_UTILS_H_ 1

#ifdef __cplusplus
extern "C"
{
#endif


/* structure describing an I/O request (including hyperslab parameters) */
typedef struct
{
  /* output frequency */
  CCTK_INT out_every;

  /* index and timelevel of the variable */
  int vindex, timelevel;

  /* dimensionality of the variable and the hyperslab */
  CCTK_INT vdim, hdim;

  /* CCTK datatype for the hyperslab */
  int hdatatype;

  /* flag indicating whether an object to be written already exists
     (and remove it in that case) */
  int check_exist;

  /* flag indicating whether to include ghostzones in the hyperslab mapping */
  int with_ghostzones;

  /* flag indicating whether to output in chunked or unchunked format */
  int out_unchunked;

  /* compression level */
  CCTK_INT compression_level;

  /* pointer to allocated buffers */
  CCTK_INT *vectors;

  /* hyperslab mapping parameters */
  CCTK_INT *origin, *direction, *extent, *downsample;

  /* offset and sizes of hyperslab into the variable's dataspace */
  CCTK_INT *hoffset, *hsize, *hsize_chunk;

  /* bitmask for refinement levels to output */
  CCTK_INT refinement_levels;

} ioRequest;


/* parse a given 'out_vars' parameter string */
void IOUtil_ParseVarsForOutput (const cGH *GH, const char *method_name,
                                const char *parameter_name,
                                int stop_on_parse_errors,
                                const char *out_vars, int out_every_default,
                                ioRequest *request_list[]);

/* parse a given I/O parameter option string for the 'out_every' option */
void IOUtil_ParseOutputFrequency (const char *method_name,
                                  const char *parameter_name,
                                  int stop_on_parse_errors,
                                  int vindex, const char *optstring,
                                  CCTK_INT *out_every);

/* return the default I/O request description structure for a variable */
ioRequest *IOUtil_DefaultIORequest (const cGH *GH, int vindex,
                                    int out_every_default);

/* free an I/O request description */
void IOUtil_FreeIORequest (ioRequest **request);

/* set the slice center for 1D lines */
int IOUtil_1DLines (const cGH *GH,
                    int num_dims,
                    int *const *const origin_index,
                    CCTK_REAL *const *const origin_phys,
                    int *const *const slice_center);

/* set the slice center for 2D planes */
int IOUtil_2DPlanes (const cGH *GH,
                     int num_dims,
                     const int *origin_index,
                     const CCTK_REAL *origin_phys,
                     int *slice_center);

/* create an output directory on all I/O processors */
int IOUtil_CreateDirectory (const cGH *GH,
                            const char *dirname,
                            int multiple_io_procs,
                            int ioproc);

#ifdef __cplusplus
}
#endif

#endif  /* _IOUTIL_IOUTIL_UTILS_H_ */