HiRep 0.1
Loading...
Searching...
No Matches
input_par.h
1/***************************************************************************\
2* Copyright (c) 2008, Claudio Pica *
3* All rights reserved. *
4\***************************************************************************/
5
6#ifndef INPUT_PAR_H
7#define INPUT_PAR_H
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13typedef enum _datatype_t { INT_T, UNSIGNED_T, DOUBLE_T, STRING_T } datatype_t;
14
15typedef struct input_record_t {
16 char *name;
17 char *descr;
18 datatype_t type;
19 void *ptr;
21
22/* Global or common variables */
23typedef struct input_glb {
24 /* global size of lattice and processing grid */
25 /* THIS ARE DEFINED GLOBALLY !!! */
26 /* int GLB_T, GLB_X, GLB_Y, GLB_Z; */
27 /* int NP_T, NP_X, NP_Y, NP_Z; */
28 /* int MPI_BLK_T, MPI_BLK_X, MPI_BLK_Y, MPI_BLK_Z; */
29 /* int N_REP; */
30
31 /* for the reading function */
32 input_record_t read[14];
33
34} input_glb;
35// clang-format off
36
37#define init_input_glb(varname) \
38 { \
39 .read = { \
40 { "GLB_T", "GLB_T = %d", INT_T, &GLB_T }, \
41 { "GLB_X", "GLB_X = %d", INT_T, &GLB_X }, \
42 { "GLB_Y", "GLB_Y = %d", INT_T, &GLB_Y }, \
43 { "GLB_Z", "GLB_Z = %d", INT_T, &GLB_Z }, \
44 { "NP_T", "NP_T = %d", INT_T, &NP_T }, \
45 { "NP_X", "NP_X = %d", INT_T, &NP_X }, \
46 { "NP_Y", "NP_Y = %d", INT_T, &NP_Y }, \
47 { "NP_Z", "NP_Z = %d", INT_T, &NP_Z }, \
48 { "MPI_BLK_T", "MPI_BLK_T = %d", INT_T, &MPI_BLK_T }, \
49 { "MPI_BLK_X", "MPI_BLK_X = %d", INT_T, &MPI_BLK_X }, \
50 { "MPI_BLK_Y", "MPI_BLK_Y = %d", INT_T, &MPI_BLK_Y }, \
51 { "MPI_BLK_Z", "MPI_BLK_Z = %d", INT_T, &MPI_BLK_Z }, \
52 { "N_REP", "N_REP = %d", INT_T, &N_REP }, \
53 { NULL, NULL, INT_T, NULL } \
54 } \
55 }
56// clang-format on
57
58/* Global or common variables */
59typedef struct input_rlx {
60 /* random numbers */
61 int rlxd_level, rlxd_seed, rlxd_store;
62 char rlxd_state[256];
63 char rlxd_start[256];
64
65 /* for the reading function */
66 input_record_t read[6];
67
68} input_rlx;
69// clang-format off
70#define init_input_rlx(varname) \
71 { .read = { { "ranlux level", "rlx_level = %d", INT_T, &(varname).rlxd_level }, \
72 { "ranlux seed", "rlx_seed = %d", INT_T, &(varname).rlxd_seed }, \
73 { "ranlux state", "rlx_state = %s", STRING_T, &(varname).rlxd_state }, \
74 { "ranlux start", "rlx_start = %s", STRING_T, &(varname).rlxd_start }, \
75 { "ranlux store", "rlx_store = %d", INT_T, &(varname).rlxd_store }, \
76 { NULL, NULL, INT_T, NULL } }, \
77 .rlxd_state = "", \
78 .rlxd_level = 0 }
79// clang-format on
80
81/* Logger global variables */
82typedef struct input_logger {
83 /* Logger level defined globally */
84 /* They are defined at input level */
85 /* If you need to separate the log level for a channel insert it here */
86
87 int def_log_lvl;
88 int inverter_log_lvl;
89 int forcestat_log_lvl;
90 /* for the reading function */
91 input_record_t read[4];
92
94
95// clang-format off
96#define init_input_logger(varname) \
97 { .read = { { "Default logger level", "log:default = %d", INT_T, &(varname).def_log_lvl }, \
98 { "Inverter logger level", "log:inverter = %d", INT_T, &(varname).inverter_log_lvl }, \
99 { "Forcestat logger level", "log:forcestat = %d", INT_T, &(varname).forcestat_log_lvl }, \
100 { NULL, NULL, INT_T, NULL } }, \
101 .def_log_lvl = -1, \
102 .inverter_log_lvl = -1, \
103 .forcestat_log_lvl = -1 }
104// clang-format on
105
106//read_input.c
107void read_input(input_record_t irec[], char *filename);
108
109#ifdef __cplusplus
110}
111#endif
112#endif /* INPUT_PAR_H */
Definition input_par.h:23
Definition input_par.h:82
Definition input_par.h:15
Definition input_par.h:59