8 #include "quadrature.h"
20 #define class_read_double(name,destination) \
22 class_call(parser_read_double(pfc,name,¶m1,&flag1,errmsg), \
25 if (flag1 == _TRUE_) \
26 destination = param1; \
30 #define class_read_int(name,destination) \
32 class_call(parser_read_int(pfc,name,&int1,&flag1,errmsg), \
35 if (flag1 == _TRUE_) \
39 #define class_read_string(name,destination) \
41 class_call(parser_read_string(pfc,name,&string1,&flag1,errmsg), \
44 if (flag1 == _TRUE_) \
45 strcpy(destination,string1); \
48 #define class_read_double_one_of_two(name1,name2,destination) \
50 class_call(parser_read_double(pfc,name1,¶m1,&flag1,errmsg), \
53 class_call(parser_read_double(pfc,name2,¶m2,&flag2,errmsg), \
56 class_test((flag1 == _TRUE_) && (flag2 == _TRUE_), \
58 "In input file, you can only enter one of %s, %s, choose one", \
60 if (flag1 == _TRUE_) \
61 destination = param1; \
62 if (flag2 == _TRUE_) \
63 destination = param2; \
66 #define class_at_least_two_of_three(a,b,c) \
67 ((a == _TRUE_) && (b == _TRUE_)) || \
68 ((a == _TRUE_) && (c == _TRUE_)) || \
69 ((b == _TRUE_) && (c == _TRUE_))
71 #define class_none_of_three(a,b,c) \
72 (a == _FALSE_) && (b == _FALSE_) && (c == _FALSE_)
75 #define class_read_list_of_doubles_or_default(name,destination,default,siz) \
77 class_call(parser_read_list_of_doubles(pfc,name, \
78 &entries_read,&(destination),&flag1,errmsg), \
81 if (flag1 == _TRUE_){ \
82 class_test(entries_read != siz,errmsg, \
83 "Number of entries in %s, %d, does not match expected number, %d.", \
84 name,entries_read,siz); \
86 class_alloc(destination,siz*sizeof(double),errmsg); \
87 for(n=0; n<siz; n++) destination[n] = default; \
91 #define class_read_list_of_integers_or_default(name,destination,default,siz) \
93 class_call(parser_read_list_of_integers(pfc,name, \
94 &entries_read,&(destination),&flag1,errmsg), \
97 if (flag1 == _TRUE_){ \
98 class_test(entries_read != siz,errmsg, \
99 "Number of entries in %s, %d, does not match expected number, %d.", \
100 name,entries_read,siz); \
102 class_alloc(destination,siz*sizeof(int),errmsg); \
103 for(n=0; n<siz; n++) destination[n] = default; \
107 #define class_read_list_of_doubles(name,destination,siz) \
109 class_call(parser_read_list_of_doubles(pfc,name, \
110 &entries_read,&(destination),&flag1,errmsg), \
113 class_test(flag1 == _FALSE_,errmsg, \
114 "Entry %s is required but not found!",name) \
115 class_test(entries_read != siz,errmsg, \
116 "Number of entries in %s, %d, does not match expected number, %d.", \
117 name,entries_read,siz); \
120 #define class_read_list_of_integers(name,destination,siz) \
122 class_call(parser_read_list_of_integers(pfc,name, \
123 &entries_read,&(destination),&flag1,errmsg), \
126 class_test(flag1 == _FALSE_,errmsg, \
127 "Entry %s is required but not found!",name) \
128 class_test(entries_read != siz,errmsg, \
129 "Number of entries in %s, %d, does not match expected number, %d.", \
130 name,entries_read,siz); \
137 enum target_names {theta_s, Omega_dcdmdr, omega_dcdmdr, Omega_scf, Omega_ini_dcdm, omega_ini_dcdm};
138 enum computation_stage {cs_background, cs_thermodynamics, cs_perturbations,
139 cs_primordial, cs_nonlinear, cs_transfer, cs_spectra};
140 #define _NUM_TARGETS_ 6 //Keep this number as number of target_names
142 struct input_pprpba {
147 struct fzerofun_workspace {
148 int * unknown_parameters_index;
149 struct file_content fc;
151 double * target_value;
153 enum computation_stage required_computation_stage;
183 struct file_content * pfc,
198 struct file_content * pfc,
230 int class_fzero_ridder(
int (*func)(
double x,
void *param,
double *y, ErrorMsg error_message),
239 ErrorMsg error_message);
241 int input_fzerofun_for_background(
double Omega_ini_dcdm,
244 ErrorMsg error_message);
247 int unknown_parameters_size,
252 int input_fzerofun_1d(
double input,
253 void* fzerofun_workspace,
255 ErrorMsg error_message);
259 struct fzerofun_workspace * pfzw,
264 struct fzerofun_workspace *pfzw,
267 int file_exists(
const char *fname);
269 int input_auxillary_target_conditions(
struct file_content * pfc,
273 ErrorMsg error_message);
275 int compare_integers (
const void * elem1,
const void * elem2);
277 int compare_doubles(
const void *a,
const void *b);
Definition: background.h:25
Definition: nonlinear.h:20
Definition: perturbations.h:95
Definition: thermodynamics.h:57
Definition: transfer.h:38
Definition: primordial.h:79