CLASSpp Manual
Cosmology reference and developer manual
Loading...
Searching...
No Matches
spectra_module.h
1#ifndef SPECTRA_MODULE_H
2#define SPECTRA_MODULE_H
3
4#include <map>
5#include <string>
6#include <vector>
7
8#include "acoustic_spline.h"
9#include "base_module.h"
10#include "input_module.h"
11
12class SpectraModule : public BaseModule {
13 public:
14 SpectraModule(InputModulePtr input_module,
15 PerturbationsModulePtr perturbations_module,
16 PrimordialModulePtr primordial_module_,
17 NonlinearModulePtr nonlinear_module,
18 TransferModulePtr transfer_module);
19 ~SpectraModule();
20 void spectra_cl_at_l(double l, double* cl, double** cl_md, double** cl_md_ic) const;
21 std::map<std::string, int> cl_output_index_map() const;
22 std::map<std::string, std::vector<double>> cl_output(int lmax) const;
23 void cl_output_no_copy(int lmax, std::vector<double*>& output_pointers) const;
24
28 int md_size_ = 0;
29 std::vector<int>
30 ic_size_;
31 std::vector<int>
32 ic_ic_size_;
33 std::vector<std::vector<bool>>
34 is_non_zero_;
36
40
41 bool has_tt_ = false;
42 bool has_ee_ = false;
43 bool has_te_ = false;
44 bool has_bb_ = false;
45 bool has_pp_ = false;
46 bool has_tp_ = false;
47 bool has_ep_ = false;
48 bool has_dd_ = false;
49 bool has_td_ = false;
50 bool has_pd_ = false;
51 bool has_ll_ = false;
52 bool has_tl_ = false;
53 bool has_dl_ = false;
55 int index_ct_tt_ = -1;
56 int index_ct_ee_ = -1;
57 int index_ct_te_ = -1;
58 int index_ct_bb_ = -1;
59 int index_ct_pp_ = -1;
60 int index_ct_tp_ = -1;
61 int index_ct_ep_ = -1;
62 int index_ct_dd_ =
63 -1;
64 int index_ct_td_ = -1;
65 int index_ct_pd_ = -1;
66 int index_ct_ll_ =
67 -1;
68 int index_ct_tl_ = -1;
69 int index_ct_dl_ = -1;
71 int ct_size_ = 0;
72 int d_size_ = 0;
74
75 int l_size_max_ = 0;
76 std::vector<double> l_;
77 std::vector<std::vector<int>> l_max_ct_;
82 std::vector<int> l_max_;
87 int l_max_tot_ = 0;
95 double acoustic_omega_ = 0.;
96
97 private:
100 void spectra_acoustic_at_l(int index_md, double l, double* row) const;
101 void spectra_init();
102 void spectra_indices();
103 void spectra_cls();
104 void spectra_compute_cl(int index_md,
105 int index_ic1,
106 int index_ic2,
107 int index_l,
108 int cl_integrand_num_columns,
109 double* cl_integrand,
110 const double* primordial_pk_cached,
111 const double* integration_weights,
112 const double* limber_integration_weights,
113 double* transfer_ic1,
114 double* transfer_ic2);
115
116 PerturbationsModulePtr perturbations_module_;
117 PrimordialModulePtr primordial_module_;
118 NonlinearModulePtr nonlinear_module_;
119 TransferModulePtr transfer_module_;
120
121 int index_md_scalars_ = -1;
126
127 std::vector<int>
128 l_size_;
130 std::vector<std::vector<double>>
131 cl_;
132 std::vector<std::vector<double>>
133 ddcl_;
136 std::vector<std::vector<std::pair<int, AcousticSpline>>> acoustic_;
137
139};
140
141#endif //SPECTRA_MODULE_H