24 #define POINTS ((NX)*(NY)*(NZ)) 29 #define H_LEN_FRAC 0.5 33 #ifndef USE_REFERENCE_FRW 34 #define USE_REFERENCE_FRW true 39 #define STENCIL_ORDER 8 43 #ifndef USE_BSSN_SHIFT 44 #define USE_BSSN_SHIFT false 48 #ifndef USE_GAMMA_DRIVER 49 #define USE_GAMMA_DRIVER false 53 #ifndef USE_GENERALIZED_NEWTON 54 #define USE_GENERALIZED_NEWTON false 58 #ifndef USE_LONG_DOUBLES 59 # define USE_LONG_DOUBLES false 63 #ifndef EXCLUDE_SECOND_ORDER_SMALL 64 #define EXCLUDE_SECOND_ORDER_SMALL false 66 #ifndef EXCLUDE_SECOND_ORDER_FRW 67 #define EXCLUDE_SECOND_ORDER_FRW false 72 #define USE_MULTIGRID true 74 #ifndef USE_COSMOTRACE 75 #define USE_COSMOTRACE true 79 #ifndef USE_COSMO_CONST_POTENTIAL 80 #define USE_COSMO_CONST_POTENTIAL true 82 #define COSMO_CONST 0.0003 91 #ifndef USE_Z4c_DAMPING 92 # define USE_Z4c_DAMPING false 95 # define Z4c_K1_DAMPING_AMPLITUDE 0.5 96 # define Z4c_K2_DAMPING_AMPLITUDE 0.1 98 # define Z4c_K1_DAMPING_AMPLITUDE 0.0 99 # define Z4c_K2_DAMPING_AMPLITUDE 0.0 102 #define STENCIL_CONCATENATOR(function, order) function ## order 103 #define STENCIL_EVALUATOR(function, order) STENCIL_CONCATENATOR(function, order) 104 #define STENCIL_ORDER_FUNCTION(function) STENCIL_EVALUATOR(function, STENCIL_ORDER) 106 #define PI (4.0*atan(1.0)) 107 #define SIGN(x) (((x) < 0.0) ? -1 : ((x) > 0.0)) 108 #define pw2(x) ((x)*(x)) 109 #define C_RE(c) ((c)[0]) 110 #define C_IM(c) ((c)[1]) 111 #define ROUND_2_IDXT(f) ((idx_t)(f >= 0.0 ? (f + 0.5) : (f - 0.5))) 113 #define RESTRICT __restrict__ 116 #define INDEX(i,j,k) ( ((i+4*NX)%(NX))*(NY)*(NZ) + ((j+4*NY)%(NY))*(NZ) + (k+4*NZ)%(NZ) ) 118 #define NP_INDEX(i,j,k) ((NZ)*(NY)*(i) + (NZ)*(j) + (k)) 120 #define F_INDEX(i,j,k,d) ( ((i+NX)%(NX))*(NY)*(NZ)*3 + ((j+NY)%(NY))*(NZ)*3 + (k+NZ)%(NZ)*3 + (d+2)%3 ) 122 #define F_NP_INDEX(i,j,k,d) ( (NZ)*(NY)*(i)*3 + (NZ)*(j)*3 + (k)*3 + (d+2)%3 ) 125 #define H_INDEX(i,j,k,nx,ny,nz) (((i+nx)%(nx))*(ny)*(nz) + ((j+ny)%(ny))*(nz) + (k+(nz))%(nz)) 128 #define aIDX(i,j) ( i <= j ? (7-i)*i/2 - 4 + j : (7-j)*j/2 - 4 + i ) 130 #define iIDX(i) ( i - 1 ) 133 #define LOOP3(i,j,k) \ 134 for(i=0; i<NX; ++i) \ 135 for(j=0; j<NY; ++j) \ 138 #define AREA_LOOP(j,k) \ 139 for(j=0; j<NY; ++j) \ 142 #define DECLARE_REAL_T(name) real_t name 145 #define DECLARE_ADJACENT_REAL_T(name) real_t name##_adj[3][3][3] 147 #define DECLARE_ADJ_ADJACENT_REAL_T(name) real_t name##_adj_ext[3][2] 154 #define RK4_ARRAY_ADDMAP(name) \ 155 fields[#name "_a"] = & name->_array_a; \ 156 fields[#name "_c"] = & name->_array_c; \ 157 fields[#name "_p"] = & name->_array_p; \ 158 fields[#name "_f"] = & name->_array_f 160 #define RK4_ARRAY_CREATE(name) \ 163 #define RK4_ARRAY_ALLOC(name) \ 164 name = new register_t(); \ 165 name->init(NX, NY, NZ, dt) 167 #define RK4_ARRAY_DELETE(name) \ 170 #define RK4_SET_LOCAL_VALUES(name) \ 171 bd->name = name->_array_a[bd->idx]; 175 #define GEN1_ARRAY_ADDMAP(name) \ 176 fields[#name "_a"] = &name##_a 178 #define GEN1_ARRAY_CREATE(name) \ 181 #define GEN1_ARRAY_ALLOC(name) \ 182 name##_a.init(NX, NY, NZ) 184 #define GEN1_ARRAY_DELETE(name) 186 #define GEN1_SET_LOCAL_VALUES(name) \ 187 bd->name = name##_a[bd->idx]; 191 #define COSMO_SUMMATION_1(MACRO) \ 192 ( MACRO(1) + MACRO(2) + MACRO(3) ) 194 #define COSMO_SUMMATION_1_ARGS(MACRO, ...) \ 195 ( MACRO(1, __VA_ARGS__) + MACRO(2, __VA_ARGS__) + MACRO(3, __VA_ARGS__) ) 197 #define COSMO_SUMMATION_2(MACRO) ( \ 198 MACRO(1, 1) + MACRO(1, 2) + MACRO(1, 3) \ 199 + MACRO(2, 1) + MACRO(2, 2) + MACRO(2, 3) \ 200 + MACRO(3, 1) + MACRO(3, 2) + MACRO(3, 3) \ 203 #define COSMO_SUMMATION_2_ARGS(MACRO, ...) ( \ 204 MACRO(1, 1, __VA_ARGS__) + MACRO(1, 2, __VA_ARGS__) + MACRO(1, 3, __VA_ARGS__) \ 205 + MACRO(2, 1, __VA_ARGS__) + MACRO(2, 2, __VA_ARGS__) + MACRO(2, 3, __VA_ARGS__) \ 206 + MACRO(3, 1, __VA_ARGS__) + MACRO(3, 2, __VA_ARGS__) + MACRO(3, 3, __VA_ARGS__) \ 209 #define COSMO_SUMMATION_3(MACRO) ( \ 210 MACRO(1, 1, 1) + MACRO(1, 1, 2) + MACRO(1, 1, 3) \ 211 + MACRO(1, 2, 1) + MACRO(1, 2, 2) + MACRO(1, 2, 3) \ 212 + MACRO(1, 3, 1) + MACRO(1, 3, 2) + MACRO(1, 3, 3) \ 213 + MACRO(2, 1, 1) + MACRO(2, 1, 2) + MACRO(2, 1, 3) \ 214 + MACRO(2, 2, 1) + MACRO(2, 2, 2) + MACRO(2, 2, 3) \ 215 + MACRO(2, 3, 1) + MACRO(2, 3, 2) + MACRO(2, 3, 3) \ 216 + MACRO(3, 1, 1) + MACRO(3, 1, 2) + MACRO(3, 1, 3) \ 217 + MACRO(3, 2, 1) + MACRO(3, 2, 2) + MACRO(3, 2, 3) \ 218 + MACRO(3, 3, 1) + MACRO(3, 3, 2) + MACRO(3, 3, 3) \ 221 #define COSMO_SUMMATION_3_ARGS(MACRO, ...) ( \ 222 MACRO(1, 1, 1, __VA_ARGS__) + MACRO(1, 1, 2, __VA_ARGS__) + MACRO(1, 1, 3, __VA_ARGS__) \ 223 + MACRO(1, 2, 1, __VA_ARGS__) + MACRO(1, 2, 2, __VA_ARGS__) + MACRO(1, 2, 3, __VA_ARGS__) \ 224 + MACRO(1, 3, 1, __VA_ARGS__) + MACRO(1, 3, 2, __VA_ARGS__) + MACRO(1, 3, 3, __VA_ARGS__) \ 225 + MACRO(2, 1, 1, __VA_ARGS__) + MACRO(2, 1, 2, __VA_ARGS__) + MACRO(2, 1, 3, __VA_ARGS__) \ 226 + MACRO(2, 2, 1, __VA_ARGS__) + MACRO(2, 2, 2, __VA_ARGS__) + MACRO(2, 2, 3, __VA_ARGS__) \ 227 + MACRO(2, 3, 1, __VA_ARGS__) + MACRO(2, 3, 2, __VA_ARGS__) + MACRO(2, 3, 3, __VA_ARGS__) \ 228 + MACRO(3, 1, 1, __VA_ARGS__) + MACRO(3, 1, 2, __VA_ARGS__) + MACRO(3, 1, 3, __VA_ARGS__) \ 229 + MACRO(3, 2, 1, __VA_ARGS__) + MACRO(3, 2, 2, __VA_ARGS__) + MACRO(3, 2, 3, __VA_ARGS__) \ 230 + MACRO(3, 3, 1, __VA_ARGS__) + MACRO(3, 3, 2, __VA_ARGS__) + MACRO(3, 3, 3, __VA_ARGS__) \