FML
Loading...
Searching...
No Matches
Main.cpp
Go to the documentation of this file.
2#include <FML/Spline/Spline.h>
4
5int main() {
6
7 double Omegab = 0.049;
8 double OmegaCDM = 0.2637;
9 double OmegaMNu = 0.0;
10 double kpivot = 0.05;
11 double As = 2.215e-9;
12 double ns = 0.966;
13 double h = 0.671;
14 std::string fileformat = "CAMB";
15
16 // Read all the CAMB transfer function data and spline the functions T_i(k,a) and P_i(k,a)
17 std::string infofile = "transfer_infofile.txt";
18 FML::FILEUTILS::LinearTransferData camb(Omegab, OmegaCDM, OmegaMNu, kpivot, As, ns, h, fileformat);
19 camb.read_transfer(infofile);
20
21 // If we only have a single power-spectrum file: read it and spline it
22 std::string pofkfile = "camb_transfer_data/lcdm_nu0.2_matterpower_z0.000.dat";
23 auto data = camb.read_power_single(pofkfile);
24 Spline pofk_cb_spline(data.first, data.second);
25
26 // Output the power-spectrum
27 const double scale_factor = 1.0;
28 const double kmin = 0.001;
29 const double kmax = 10.0;
30 const int npts = 200;
31 std::cout << "# k (h/Mpc) P(k) (Mpc/h)^3 Pcb(k) (Mpc/h)^3 Pcb(k) (Mpc/h)^3 \n";
32 for (int i = 0; i < npts; i++) {
33 double k = std::exp(std::log(kmin) + std::log(kmax / kmin) * i / double(npts));
34 std::cout << std::setw(15) << k << " ";
35 std::cout << std::setw(15) << camb.get_total_power_spectrum(k, scale_factor) << " ";
36 std::cout << std::setw(15) << camb.get_cdm_baryon_power_spectrum(k, scale_factor) << " ";
37 std::cout << std::setw(15) << pofk_cb_spline(k) << "\n";
38 }
39}
int main()
Definition Main.cpp:14
const double h
Definition Main.cpp:66
const double kpivot
Definition Main.cpp:69
This class reads transfer/power-spectrum data from the output of a Einstein-Boltzmann solver.
Definition CAMBReader.h:115
This is a wrapper class for easy use of GSL splines It is (OpenMP) thread safe as long as splines are...
Definition Spline.h:106
const double kmax
Definition test_fnl.cpp:43