Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
ccl_test_params_mnu.c
Go to the documentation of this file.
1 #include "ccl.h"
2 #include "ctest.h"
3 
4 // We can define any constants we want to use in a set of tests here.
5 // They are accessible as data->Omega_c, etc., in the tests themselves below.
6 // "params" is the name of the whole suite of tests.
7 CTEST_DATA(create_mnu) {
8  double Omega_c;
9  double Omega_b;
10  double h;
11  double A_s;
12  double n_s;
13  double wa;
14  double w0;
15  double Omega_k;
16  double mnuval;
17  double Neff;
18  int status;
21 };
22 
23 // This function is one before each test defined below with CTEST2 in the suite.
24 // It is used to set up any values needed by the tests. The data
25 // that can be passed to the tests are always in a struct called "data"
26 // and defined above.
27 CTEST_SETUP(create_mnu) {
28  data->Omega_c = 0.25;
29  data->Omega_b = 0.05;
30  data->h = 0.7;
31  data->A_s = 2.1e-9;
32  data->n_s = 0.96;
33  data->wa = 0.01;
34  data->w0 = -1.0;
35  data->Neff=3.046;
36  data->Omega_k = 0.;
37  data->mnuval = 0.15;
38  data->mnu_type_norm = ccl_mnu_sum;
39  data->mnu_type_inv = ccl_mnu_sum_inverted;
40  data->status = 0;
41 
42 }
43 
44 // This adds a new test called "create_mnu" to the suite called "params".
45 // There are a variety of different assertions available.
46 
47 // If you wanted to you could call other functions in here too and use these
48 // assertions there also.
49 CTEST2(create_mnu, create_mnu_norm) {
50  ccl_parameters params_norm = ccl_parameters_create(data->Omega_c, data->Omega_b, data->Omega_k,
51  data->Neff, &(data->mnuval), data->mnu_type_norm,
52  data->w0, data->wa,
53  data->h, data->A_s, data->n_s,-1,-1,-1,-1,NULL,NULL, &(data->status));
54 
55  ASSERT_DBL_NEAR_TOL(params_norm.mnu[1]*params_norm.mnu[1] - params_norm.mnu[0]*params_norm.mnu[0], DELTAM12_sq, 1e-4);
56  ASSERT_DBL_NEAR_TOL(params_norm.mnu[2]*params_norm.mnu[2] - params_norm.mnu[0]*params_norm.mnu[0], DELTAM13_sq_pos, 1e-4);
57 }
58 
59 CTEST2(create_mnu, create_mnu_inv){
60 
61  ccl_parameters params_inv = ccl_parameters_create(data->Omega_c, data->Omega_b, data->Omega_k,
62  data->Neff, &(data->mnuval), data->mnu_type_inv,
63  data->w0, data->wa,
64  data->h, data->A_s, data->n_s,-1,-1,-1,-1,NULL,NULL, &(data->status));
65 
66  ASSERT_DBL_NEAR_TOL(params_inv.mnu[1]*params_inv.mnu[1] - params_inv.mnu[0]*params_inv.mnu[0], DELTAM12_sq, 1e-4);
67  ASSERT_DBL_NEAR_TOL(params_inv.mnu[2]*params_inv.mnu[2] - params_inv.mnu[0]*params_inv.mnu[0], DELTAM13_sq_neg, 1e-4);
68 
69 }
70 
double * mnu
Definition: ccl_core.h:40
#define DELTAM12_sq
#define CTEST_SETUP(sname)
Definition: ctest.h:73
#define CTEST_DATA(sname)
Definition: ctest.h:71
ccl_mnu_convention mnu_type_norm
#define DELTAM13_sq_pos
ccl_mnu_convention
Definition: ccl_core.h:142
#define ASSERT_DBL_NEAR_TOL(exp, real, tol)
Definition: ctest.h:152
#define DELTAM13_sq_neg
ccl_mnu_convention mnu_type_inv
ccl_parameters ccl_parameters_create(double Omega_c, double Omega_b, double Omega_k, double Neff, double *mnu, ccl_mnu_convention mnu_type, double w0, double wa, double h, double norm_pk, double n_s, double bcm_log10Mc, double bcm_etab, double bcm_ks, int nz_mgrowth, double *zarr_mgrowth, double *dfarr_mgrowth, int *status)
Definition: ccl_core.c:294
#define CTEST2(sname, tname)
Definition: ctest.h:107