source: Sophya/trunk/Cosmo/SimLSS/pkspectrum.h@ 3381

Last change on this file since 3381 was 3381, checked in by cmv, 18 years ago

1-/ pkspectrum: GrowthFactor + PkSpectrum on enleve les memorisations

des calculs precedents, tout est recalcule

2-/ cmvfitpk: mise de Ob+Ol+Oc+h100+ns dans le fit

cmv 14/11/2007

File size: 4.8 KB
Line 
1#ifndef PKSPECTRUM_SEEN
2#define PKSPECTRUM_SEEN
3
4#include "machdefs.h"
5#include "genericfunc.h"
6
7namespace SOPHYA {
8
9//-----------------------------------------------------------------------------------
10class InitialSpectrum : public GenericFunc {
11public:
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;}
18protected:
19 double n_, A_;
20};
21
22//-----------------------------------------------------------------------------------
23class TransfertEisenstein : public GenericFunc {
24public:
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);
37protected:
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//-----------------------------------------------------------------------------------
55class TransfertTabulate : public GenericFunc {
56public:
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);
64protected:
65 double Oc_,Ob_,h100_;
66 double kmin_,kmax_;
67 int interptyp_;
68 vector<double> k_, tf_;
69};
70
71
72//-----------------------------------------------------------------------------------
73class GrowthFactor : public GenericFunc {
74public:
75 GrowthFactor(double OmegaMatter0,double OmegaLambda0);
76 GrowthFactor(GrowthFactor& d1);
77 virtual ~GrowthFactor(void);
78 virtual double operator() (double z);
79 void SetParTo(double OmegaMatter0,double OmegaLambda0);
80 bool SetParTo(double OmegaMatter0);
81protected:
82 double O0_,Ol_;
83};
84
85
86//-----------------------------------------------------------------------------------
87class PkSpectrum0 : public GenericFunc {
88public:
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_;}
95protected:
96 InitialSpectrum& pkinf_;
97 TransfertEisenstein& tf_;
98};
99
100//-----------------------------------------------------------------------------------
101class PkSpectrumZ : public GenericFunc {
102public:
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_;}
116protected:
117 PkSpectrum0& pk0_;
118 GrowthFactor& d1_;
119 double zref_, scale_;
120 ReturnSpectrum typspec_;
121};
122
123//-----------------------------------------------------------------------------------
124class VarianceSpectrum : public GenericFunc {
125public:
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
147protected:
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
Note: See TracBrowser for help on using the repository browser.