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);
|
---|
17 | void SetSlope(double 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=-1.,double OmegaCDM0=-1.,double OmegaBaryon0=-1.,double tcmb=-1.,bool nobaryon=false);
|
---|
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(double h100,double OmegaCDM0,double OmegaBaryon0);
|
---|
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);
|
---|
64 | protected:
|
---|
65 | double Oc_,Ob_,h100_;
|
---|
66 | double kmin_,kmax_;
|
---|
67 | int interptyp_;
|
---|
68 | vector<double> k_, tf_;
|
---|
69 | };
|
---|
70 |
|
---|
71 |
|
---|
72 | //-----------------------------------------------------------------------------------
|
---|
73 | class GrowthFactor : public GenericFunc {
|
---|
74 | public:
|
---|
75 | GrowthFactor(double OmegaMatter0,double OmegaLambda0);
|
---|
76 | GrowthFactor(GrowthFactor& d1);
|
---|
77 | virtual ~GrowthFactor(void);
|
---|
78 | virtual double operator() (double z);
|
---|
79 | bool SetParTo(double OmegaMatter0=-1.,double OmegaLambda0=-12345.);
|
---|
80 | protected:
|
---|
81 | double O0_,Ol_,Ok_;
|
---|
82 | double norm_;
|
---|
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 | inline void SetZ(double z) {zref_ = z;}
|
---|
110 | inline double GetZ(void) {return zref_;}
|
---|
111 | void SetTypSpec(ReturnSpectrum typspec=PK);
|
---|
112 | inline void SetScale(double scale=1.) {scale_=scale; zold_=-1.;}
|
---|
113 | inline 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 | mutable double zold_, d1old_;
|
---|
122 | };
|
---|
123 |
|
---|
124 | //-----------------------------------------------------------------------------------
|
---|
125 | class VarianceSpectrum : public GenericFunc {
|
---|
126 | public:
|
---|
127 |
|
---|
128 | typedef enum {TOPHAT=0, GAUSSIAN=1, NOFILTER=2} TypeFilter;
|
---|
129 |
|
---|
130 | VarianceSpectrum(GenericFunc& pk,double R,TypeFilter typfilter);
|
---|
131 | VarianceSpectrum(VarianceSpectrum& pkinf);
|
---|
132 | virtual ~VarianceSpectrum(void);
|
---|
133 |
|
---|
134 | void SetRadius(double R);
|
---|
135 | void SetFilter(TypeFilter typfilter=TOPHAT);
|
---|
136 | void SetInteg(double dperc=0.1,double dlogkinc=-1.,double dlogkmax=-1.,unsigned short glorder=4);
|
---|
137 |
|
---|
138 | double Variance(double kmin,double kmax);
|
---|
139 |
|
---|
140 | // ATTENTION: La fonction a integrer est : f(k)dk = k^3*Pk(k)/(2Pi^2) *filter2(k*R) *dk/k
|
---|
141 | virtual double operator() (double k) {return k*k*pk_(k)*Filter2(k*R_)/(2.*M_PI*M_PI);}
|
---|
142 | double Filter2(double x);
|
---|
143 |
|
---|
144 | // Aide a l'integration
|
---|
145 | double FindMaximum(double kmin,double kmax,double eps=1.e-3);
|
---|
146 | int FindLimits(double high,double &kmin,double &kmax,double eps=1.e-3);
|
---|
147 |
|
---|
148 | protected:
|
---|
149 |
|
---|
150 | GenericFunc& pk_;
|
---|
151 | TypeFilter typfilter_;
|
---|
152 | double R_;
|
---|
153 |
|
---|
154 | double dperc_,dlogkinc_,dlogkmax_;
|
---|
155 | unsigned short glorder_;
|
---|
156 |
|
---|
157 | };
|
---|
158 |
|
---|
159 | } // Fin du namespace SOPHYA
|
---|
160 |
|
---|
161 | #endif
|
---|