1 | #ifndef PKSPECTRUM_SEEN
|
---|
2 | #define PKSPECTRUM_SEEN
|
---|
3 |
|
---|
4 | #include "machdefs.h"
|
---|
5 | #include "genericfunc.h"
|
---|
6 |
|
---|
7 | namespace SOPHYA {
|
---|
8 |
|
---|
9 | //-----------------------------------------------------------------------------------
|
---|
10 | class InitialSpectrum : public GenericFunc {
|
---|
11 | public:
|
---|
12 | InitialSpectrum(double n,double a=1.);
|
---|
13 | InitialSpectrum(InitialSpectrum& pkinf);
|
---|
14 | virtual ~InitialSpectrum(void);
|
---|
15 | virtual double operator() (double k) {return A_ * pow(k,n_);}
|
---|
16 | void SetNorm(double a) {A_ = a;}
|
---|
17 | void SetSlope(double n) {n_ = n;}
|
---|
18 | protected:
|
---|
19 | double n_, A_;
|
---|
20 | };
|
---|
21 |
|
---|
22 | //-----------------------------------------------------------------------------------
|
---|
23 | class TransfertEisenstein : public GenericFunc {
|
---|
24 | public:
|
---|
25 |
|
---|
26 | typedef enum{ALL=0, CDM=1, BARYON=2} ReturnPart;
|
---|
27 |
|
---|
28 | TransfertEisenstein(double h100,double OmegaCDM0,double OmegaBaryon0,double tcmb,bool nobaryon=false,int lp=0);
|
---|
29 | TransfertEisenstein(TransfertEisenstein& tf);
|
---|
30 | virtual ~TransfertEisenstein(void);
|
---|
31 | bool SetParTo(double h100,double OmegaCDM0,double OmegaBaryon0);
|
---|
32 | virtual double operator() (double k);
|
---|
33 | double KPeak(void);
|
---|
34 | void SetNoOscEnv(unsigned short nooscenv=0);
|
---|
35 | void SetReturnPart(ReturnPart retpart=ALL);
|
---|
36 | void SetPrintLevel(int lp=0);
|
---|
37 | protected:
|
---|
38 | int lp_;
|
---|
39 | double O0_,Oc_,Ob_,h100_,tcmb_;
|
---|
40 | double th2p7_;
|
---|
41 | double zeq_,keq_,zd_,Req_,Rd_,s_,ksilk_,alphac_,betac_,bnode_,alphab_,betab_;
|
---|
42 | double alphag_;
|
---|
43 | double sfit_,kpeak_;
|
---|
44 |
|
---|
45 | bool nobaryon_;
|
---|
46 | unsigned short nooscenv_;
|
---|
47 | ReturnPart retpart_;
|
---|
48 |
|
---|
49 | double T0tild(double k,double alphac,double betac);
|
---|
50 | void Init_(void);
|
---|
51 | void zero_(void);
|
---|
52 | };
|
---|
53 |
|
---|
54 | //-----------------------------------------------------------------------------------
|
---|
55 | class TransfertTabulate : public GenericFunc {
|
---|
56 | public:
|
---|
57 | TransfertTabulate(void);
|
---|
58 | TransfertTabulate(TransfertTabulate& tf);
|
---|
59 | virtual ~TransfertTabulate(void);
|
---|
60 | virtual double operator() (double k);
|
---|
61 | int NPoints(void) {return k_.size();}
|
---|
62 | void SetInterpTyp(int typ=0);
|
---|
63 | int ReadCMBFast(string filename,double h100,double OmegaCDM0,double OmegaBaryon0);
|
---|
64 | protected:
|
---|
65 | double kmin_,kmax_;
|
---|
66 | int interptyp_;
|
---|
67 | vector<double> k_, tf_;
|
---|
68 | };
|
---|
69 |
|
---|
70 |
|
---|
71 | //-----------------------------------------------------------------------------------
|
---|
72 | class GrowthFactor : public GenericFunc {
|
---|
73 | public:
|
---|
74 | GrowthFactor(double OmegaMatter0,double OmegaLambda0);
|
---|
75 | GrowthFactor(GrowthFactor& d1);
|
---|
76 | virtual ~GrowthFactor(void);
|
---|
77 | virtual double operator() (double z);
|
---|
78 | virtual double DsDz(double z,double dzinc=0.01);
|
---|
79 | void SetParTo(double OmegaMatter0,double OmegaLambda0);
|
---|
80 | bool SetParTo(double OmegaMatter0);
|
---|
81 | protected:
|
---|
82 | double O0_,Ol_;
|
---|
83 | };
|
---|
84 |
|
---|
85 |
|
---|
86 | //-----------------------------------------------------------------------------------
|
---|
87 | class PkSpectrum0 : public GenericFunc {
|
---|
88 | public:
|
---|
89 | PkSpectrum0(InitialSpectrum& pkinf,TransfertEisenstein& tf);
|
---|
90 | PkSpectrum0(PkSpectrum0& pk0);
|
---|
91 | virtual ~PkSpectrum0(void);
|
---|
92 | virtual double operator() (double z);
|
---|
93 | InitialSpectrum& GetPkIni(void) {return pkinf_;}
|
---|
94 | TransfertEisenstein& GetTransfert(void) {return tf_;}
|
---|
95 | protected:
|
---|
96 | InitialSpectrum& pkinf_;
|
---|
97 | TransfertEisenstein& tf_;
|
---|
98 | };
|
---|
99 |
|
---|
100 | //-----------------------------------------------------------------------------------
|
---|
101 | class PkSpectrumZ : public GenericFunc {
|
---|
102 | public:
|
---|
103 | typedef enum {PK=0, DELTA=1} ReturnSpectrum;
|
---|
104 | PkSpectrumZ(PkSpectrum0& pk0,GrowthFactor& d1,double zref=0.);
|
---|
105 | PkSpectrumZ(PkSpectrumZ& pkz);
|
---|
106 | virtual ~PkSpectrumZ(void);
|
---|
107 | virtual double operator() (double k);
|
---|
108 | virtual double operator() (double k,double z);
|
---|
109 | void SetZ(double z) {zref_ = z;}
|
---|
110 | double GetZ(void) {return zref_;}
|
---|
111 | void SetTypSpec(ReturnSpectrum typspec=PK);
|
---|
112 | void SetScale(double scale=1.) {scale_=scale;}
|
---|
113 | double GetScale(void) {return scale_;}
|
---|
114 | PkSpectrum0& GetPk0(void) {return pk0_;}
|
---|
115 | GrowthFactor& GetGrowthFactor(void) {return d1_;}
|
---|
116 | protected:
|
---|
117 | PkSpectrum0& pk0_;
|
---|
118 | GrowthFactor& d1_;
|
---|
119 | double zref_, scale_;
|
---|
120 | ReturnSpectrum typspec_;
|
---|
121 | };
|
---|
122 |
|
---|
123 | //-----------------------------------------------------------------------------------
|
---|
124 | class VarianceSpectrum : public GenericFunc {
|
---|
125 | public:
|
---|
126 |
|
---|
127 | typedef enum {TOPHAT=0, GAUSSIAN=1, NOFILTER=2} TypeFilter;
|
---|
128 |
|
---|
129 | VarianceSpectrum(GenericFunc& pk,double R,TypeFilter typfilter);
|
---|
130 | VarianceSpectrum(VarianceSpectrum& pkinf);
|
---|
131 | virtual ~VarianceSpectrum(void);
|
---|
132 |
|
---|
133 | void SetRadius(double R);
|
---|
134 | void SetFilter(TypeFilter typfilter=TOPHAT);
|
---|
135 | void SetInteg(double dperc=0.1,double dlogkinc=-1.,double dlogkmax=-1.,unsigned short glorder=4);
|
---|
136 |
|
---|
137 | double Variance(double kmin,double kmax);
|
---|
138 |
|
---|
139 | // ATTENTION: La fonction a integrer est : f(k)dk = k^3*Pk(k)/(2Pi^2) *filter2(k*R) *dk/k
|
---|
140 | virtual double operator() (double k) {return k*k*pk_(k)*Filter2(k*R_)/(2.*M_PI*M_PI);}
|
---|
141 | double Filter2(double x);
|
---|
142 |
|
---|
143 | // Aide a l'integration
|
---|
144 | double FindMaximum(double kmin,double kmax,double eps=1.e-3);
|
---|
145 | int FindLimits(double high,double &kmin,double &kmax,double eps=1.e-3);
|
---|
146 |
|
---|
147 | protected:
|
---|
148 |
|
---|
149 | GenericFunc& pk_;
|
---|
150 | TypeFilter typfilter_;
|
---|
151 | double R_;
|
---|
152 |
|
---|
153 | double dperc_,dlogkinc_,dlogkmax_;
|
---|
154 | unsigned short glorder_;
|
---|
155 |
|
---|
156 | };
|
---|
157 |
|
---|
158 | } // Fin du namespace SOPHYA
|
---|
159 |
|
---|
160 | #endif
|
---|