Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
ccl_test_cosmology.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(cosmology) {
8  double Omega_c;
9  double Omega_b;
10  double Omega_k;
11  double h;
12  double A_s;
13  double n_s;
14  double wa;
15  double w0;
16  double Neff;
17  double mnuval;
19  int status;
20 };
21 
22 // This function is one before each test defined below with CTEST2 in the suite.
23 // It is used to set up any values needed by the tests. The data
24 // that can be passed to the tests are always in a struct called "data"
25 // and defined above.
26 CTEST_SETUP(cosmology) {
27  data->Omega_c = 0.25;
28  data->Omega_b = 0.05;
29  data->Omega_k = 0.00;
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 = 0.;
36  data->mnuval =0.;
37  data->status=0;
38  data->mnu_type =ccl_mnu_sum;
39 }
40 
41 // Check to see if general ccl_cosmology struct is initialized correctly
42 CTEST2(cosmology, create_general_cosmo) {
45  data->Omega_c, data->Omega_b, data->h, data->A_s, data->n_s,
46  &(data->status));
47 
48  // Initialize ccl_cosmology struct
49  ccl_cosmology * cosmo = ccl_cosmology_create(params, config);
50 
51  // test a few critical things
52  ASSERT_EQUAL(cosmo->status, 0);
53  ASSERT_DBL_NEAR_TOL(cosmo->data.growth0, 1., 1e-10);
54 }
double growth0
Definition: ccl_core.h:81
ccl_mnu_convention mnu_type
#define CTEST_SETUP(sname)
Definition: ctest.h:73
#define CTEST_DATA(sname)
Definition: ctest.h:71
ccl_cosmology * ccl_cosmology_create(ccl_parameters params, ccl_configuration config)
Definition: ccl_core.c:173
ccl_mnu_convention
Definition: ccl_core.h:142
dictionary params
Definition: halomod_bm.py:27
#define ASSERT_DBL_NEAR_TOL(exp, real, tol)
Definition: ctest.h:152
const ccl_configuration default_config
Definition: ccl_core.c:21
#define ASSERT_EQUAL(exp, real)
Definition: ctest.h:121
ccl_parameters ccl_parameters_create_flat_lcdm(double Omega_c, double Omega_b, double h, double norm_pk, double n_s, int *status)
Definition: ccl_core.c:505
ccl_data data
Definition: ccl_core.h:126
#define CTEST2(sname, tname)
Definition: ctest.h:107