Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
test_core_power.cpp
Go to the documentation of this file.
1 #include <catch.hpp>
2 
3 #define BOOST_LOG_DYN_LINK 1
4 #include <boost/log/trivial.hpp>
5 
6 #include "../core_power.cpp"
7 
8 TEST_CASE( "UNIT TEST: growth functions {growth_factor, growth_rate, growth_change}", "[core_power]" )
9 {
10  BOOST_LOG_TRIVIAL(info) << "growth functions {growth_factor, growth_rate, growth_change}";
11 
12  int argc = 1;
13  const char* const argv[1] = {"test"};
14  Sim_Param sim(argc, argv);
15  FTYPE_t D, D_to_a, f, Oma, OLa, dDda, factor;
16  for (FTYPE_t a =0; a <= 1.0; a += 0.1)
17  {
18  D = growth_factor(a, sim.cosmo);
19  f = growth_rate(a, sim.cosmo);
20  dDda = growth_change(a, sim.cosmo);
21  D_to_a = a ? D/a : dDda;
22  CHECK( dDda == Approx(D_to_a*f) );
23  }
24 
25  CHECK(0.0 == growth_factor(0, sim.cosmo));
26  CHECK(1.0 == growth_factor(1, sim.cosmo));
27 }
: class storing simulation parameters
Definition: params.hpp:193
TEST_CASE("UNIT TEST: growth functions {growth_factor, growth_rate, growth_change}","[core_power]")
Cosmo_Param cosmo
Definition: params.hpp:206
double growth_rate(double a, const Cosmo_Param &cosmo)
Definition: core_power.cpp:429
#define CHECK(...)
Definition: catch.hpp:13860
double growth_change(double a, const Cosmo_Param &cosmo)
Definition: core_power.cpp:447