Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
ccl_test_utils.c File Reference
#include <gsl/gsl_sf_bessel.h>
#include "ccl.h"
#include "ctest.h"
#include "ccl_params.h"
#include "ccl_core.h"
Include dependency graph for ccl_test_utils.c:

Go to the source code of this file.

Functions

void __ctest_spacing_tests_linear_spacing_simple_run ()
 
static struct ctest __ctest_spacing_tests_linear_spacing_simple __attribute__ ((used, section(".ctest"))) = { .ssname="spacing_tests", .ttname="log_spacing_simple", .run = __ctest_spacing_tests_log_spacing_simple_run, .skip = 0 , .data = NULL , .setup = (SetupFunc) NULL , .teardown = (TearDownFunc) NULL , .magic = (0xdeadbeef) }
 
void __ctest_spacing_tests_log_spacing_simple_run ()
 
void __ctest_spacing_tests_linlog_spacing_simple_run ()
 
void __ctest_spherical_bessel_tests_compare_gsl_run ()
 

Function Documentation

static struct ctest __ctest_spherical_bessel_tests_compare_gsl __attribute__ ( (used, section(".ctest"))  ) = { .ssname="spacing_tests", .ttname="log_spacing_simple", .run = __ctest_spacing_tests_log_spacing_simple_run, .skip = 0 , .data = NULL , .setup = (SetupFunc) NULL , .teardown = (TearDownFunc) NULL , .magic = (0xdeadbeef) }
static
void __ctest_spacing_tests_linear_spacing_simple_run ( )

Definition at line 7 of file ccl_test_utils.c.

References ASSERT_DBL_NEAR_TOL, ASSERT_NOT_NULL, ccl_linear_spacing(), and m.

7  {
8  double * m = ccl_linear_spacing(0.0, 1.0, 5);
10  ASSERT_DBL_NEAR_TOL(0.0, m[0], 1e-10);
11  ASSERT_DBL_NEAR_TOL(0.25, m[1], 1e-10);
12  ASSERT_DBL_NEAR_TOL(0.5, m[2], 1e-10);
13  ASSERT_DBL_NEAR_TOL(0.75, m[3], 1e-10);
14  ASSERT_DBL_NEAR_TOL(1.0, m[4], 1e-10);
15  free(m);
16 }
CCL_BEGIN_DECLS double * ccl_linear_spacing(double xmin, double xmax, int N)
Definition: ccl_utils.c:14
#define ASSERT_DBL_NEAR_TOL(exp, real, tol)
Definition: ctest.h:152
static int m[2]
Definition: ccl_emu17.c:25
#define ASSERT_NOT_NULL(real)
Definition: ctest.h:139
void __ctest_spacing_tests_linlog_spacing_simple_run ( )

Definition at line 29 of file ccl_test_utils.c.

References ASSERT_DBL_NEAR_TOL, ASSERT_NOT_NULL, ccl_linlog_spacing(), and m.

29  {
30  double * m = ccl_linlog_spacing(1.0, 16.0, 32.0, 5, 9);
31  ASSERT_NOT_NULL(m);
32  ASSERT_DBL_NEAR_TOL(1.0, m[0], 1e-10);
33  ASSERT_DBL_NEAR_TOL(2.0, m[1], 1e-10);
34  ASSERT_DBL_NEAR_TOL(4.0, m[2], 1e-10);
35  ASSERT_DBL_NEAR_TOL(8.0, m[3], 1e-10);
36  ASSERT_DBL_NEAR_TOL(16.0, m[4], 1e-10);
37  ASSERT_DBL_NEAR_TOL(18.0, m[5], 1e-10);
38  ASSERT_DBL_NEAR_TOL(20.0, m[6], 1e-10);
39  ASSERT_DBL_NEAR_TOL(22.0, m[7], 1e-10);
40  ASSERT_DBL_NEAR_TOL(24.0, m[8], 1e-10);
41  ASSERT_DBL_NEAR_TOL(26.0, m[9], 1e-10);
42  ASSERT_DBL_NEAR_TOL(28.0, m[10], 1e-10);
43  ASSERT_DBL_NEAR_TOL(30.0, m[11], 1e-10);
44  ASSERT_DBL_NEAR_TOL(32.0, m[12], 1e-10);
45  free(m);
46 }
double * ccl_linlog_spacing(double xminlog, double xmin, double xmax, int Nlin, int Nlog)
Definition: ccl_utils.c:43
#define ASSERT_DBL_NEAR_TOL(exp, real, tol)
Definition: ctest.h:152
static int m[2]
Definition: ccl_emu17.c:25
#define ASSERT_NOT_NULL(real)
Definition: ctest.h:139
void __ctest_spacing_tests_log_spacing_simple_run ( )

Definition at line 18 of file ccl_test_utils.c.

References ASSERT_DBL_NEAR_TOL, ASSERT_NOT_NULL, ccl_log_spacing(), and m.

18  {
19  double * m = ccl_log_spacing(1.0, 16.0, 5);
20  ASSERT_NOT_NULL(m);
21  ASSERT_DBL_NEAR_TOL(1.0, m[0], 1e-10);
22  ASSERT_DBL_NEAR_TOL(2.0, m[1], 1e-10);
23  ASSERT_DBL_NEAR_TOL(4.0, m[2], 1e-10);
24  ASSERT_DBL_NEAR_TOL(8.0, m[3], 1e-10);
25  ASSERT_DBL_NEAR_TOL(16.0, m[4], 1e-10);
26  free(m);
27 }
double * ccl_log_spacing(double xmin, double xmax, int N)
Definition: ccl_utils.c:102
#define ASSERT_DBL_NEAR_TOL(exp, real, tol)
Definition: ctest.h:152
static int m[2]
Definition: ccl_emu17.c:25
#define ASSERT_NOT_NULL(real)
Definition: ctest.h:139
void __ctest_spherical_bessel_tests_compare_gsl_run ( )

Definition at line 48 of file ccl_test_utils.c.

References ASSERT_DBL_NEAR_TOL, ccl_j_bessel(), cl_cmbl_bm::l, x, xmax, and xmin.

48  {
49  int l, i;
50  double xmin = 0.0;
51  double xmax = 10.0;
52  int Nx = 10000;
53  double x, dx;
54 
55  dx = (xmax - xmin) / (Nx - 1);
56 
57  for (l=0; l < 15; ++l) {
58  for (i=0; i < Nx; ++i) {
59  x = dx * i + xmin;
61  ccl_j_bessel(l, x),
62  gsl_sf_bessel_jl(l, x),
63  1e-4);
64  }
65  }
66 }
double ccl_j_bessel(int l, double x)
Definition: ccl_utils.c:190
static CCL_BEGIN_DECLS double x[111][8]
#define ASSERT_DBL_NEAR_TOL(exp, real, tol)
Definition: ctest.h:152
static double xmax[8]
static double xmin[8]