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

Last change on this file since 3781 was 3768, checked in by cmv, 15 years ago
  • refonte du code pour creer uniquement des conditions initiales
  • introduction du tirage des vitesse LOS pour les redshift-distortion

cmv 03/05/2010

File size: 4.9 KB
RevLine 
[3115]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_);}
[3381]16 void SetNorm(double a) {A_ = a;}
17 void SetSlope(double n) {n_ = n;}
[3115]18protected:
19 double n_, A_;
20};
21
22//-----------------------------------------------------------------------------------
23class TransfertEisenstein : public GenericFunc {
24public:
[3348]25
26 typedef enum{ALL=0, CDM=1, BARYON=2} ReturnPart;
27
[3314]28 TransfertEisenstein(double h100,double OmegaCDM0,double OmegaBaryon0,double tcmb,bool nobaryon=false,int lp=0);
[3115]29 TransfertEisenstein(TransfertEisenstein& tf);
30 virtual ~TransfertEisenstein(void);
[3381]31 bool SetParTo(double h100,double OmegaCDM0,double OmegaBaryon0);
[3115]32 virtual double operator() (double k);
33 double KPeak(void);
34 void SetNoOscEnv(unsigned short nooscenv=0);
[3348]35 void SetReturnPart(ReturnPart retpart=ALL);
[3378]36 void SetPrintLevel(int lp=0);
[3115]37protected:
[3314]38 int lp_;
[3378]39 double O0_,Oc_,Ob_,h100_,tcmb_;
[3314]40 double th2p7_;
[3115]41 double zeq_,keq_,zd_,Req_,Rd_,s_,ksilk_,alphac_,betac_,bnode_,alphab_,betab_;
42 double alphag_;
[3314]43 double sfit_,kpeak_;
[3115]44
45 bool nobaryon_;
[3348]46 unsigned short nooscenv_;
47 ReturnPart retpart_;
[3314]48
[3115]49 double T0tild(double k,double alphac,double betac);
[3314]50 void Init_(void);
[3318]51 void zero_(void);
[3115]52};
53
[3318]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:
[3378]65 double Oc_,Ob_,h100_;
[3318]66 double kmin_,kmax_;
67 int interptyp_;
68 vector<double> k_, tf_;
69};
[3115]70
[3318]71
[3115]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);
[3768]79 virtual double DsDz(double z,double dzinc=0.01);
[3381]80 void SetParTo(double OmegaMatter0,double OmegaLambda0);
81 bool SetParTo(double OmegaMatter0);
[3115]82protected:
[3381]83 double O0_,Ol_;
[3115]84};
85
86
87//-----------------------------------------------------------------------------------
88class PkSpectrum0 : public GenericFunc {
89public:
90 PkSpectrum0(InitialSpectrum& pkinf,TransfertEisenstein& tf);
91 PkSpectrum0(PkSpectrum0& pk0);
92 virtual ~PkSpectrum0(void);
93 virtual double operator() (double z);
94 InitialSpectrum& GetPkIni(void) {return pkinf_;}
95 TransfertEisenstein& GetTransfert(void) {return tf_;}
96protected:
97 InitialSpectrum& pkinf_;
98 TransfertEisenstein& tf_;
99};
100
101//-----------------------------------------------------------------------------------
102class PkSpectrumZ : public GenericFunc {
103public:
[3348]104 typedef enum {PK=0, DELTA=1} ReturnSpectrum;
[3115]105 PkSpectrumZ(PkSpectrum0& pk0,GrowthFactor& d1,double zref=0.);
106 PkSpectrumZ(PkSpectrumZ& pkz);
107 virtual ~PkSpectrumZ(void);
108 virtual double operator() (double k);
109 virtual double operator() (double k,double z);
[3381]110 void SetZ(double z) {zref_ = z;}
111 double GetZ(void) {return zref_;}
[3348]112 void SetTypSpec(ReturnSpectrum typspec=PK);
[3381]113 void SetScale(double scale=1.) {scale_=scale;}
114 double GetScale(void) {return scale_;}
[3115]115 PkSpectrum0& GetPk0(void) {return pk0_;}
116 GrowthFactor& GetGrowthFactor(void) {return d1_;}
117protected:
118 PkSpectrum0& pk0_;
119 GrowthFactor& d1_;
120 double zref_, scale_;
[3348]121 ReturnSpectrum typspec_;
[3115]122};
123
124//-----------------------------------------------------------------------------------
125class VarianceSpectrum : public GenericFunc {
126public:
[3348]127
128 typedef enum {TOPHAT=0, GAUSSIAN=1, NOFILTER=2} TypeFilter;
129
130 VarianceSpectrum(GenericFunc& pk,double R,TypeFilter typfilter);
[3115]131 VarianceSpectrum(VarianceSpectrum& pkinf);
132 virtual ~VarianceSpectrum(void);
133
[3348]134 void SetRadius(double R);
135 void SetFilter(TypeFilter typfilter=TOPHAT);
[3115]136 void SetInteg(double dperc=0.1,double dlogkinc=-1.,double dlogkmax=-1.,unsigned short glorder=4);
137
[3348]138 double Variance(double kmin,double kmax);
[3115]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
[3348]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);
[3115]147
148protected:
149
150 GenericFunc& pk_;
[3348]151 TypeFilter typfilter_;
[3115]152 double R_;
153
154 double dperc_,dlogkinc_,dlogkmax_;
155 unsigned short glorder_;
156
157};
158
[3325]159} // Fin du namespace SOPHYA
[3115]160
161#endif
Note: See TracBrowser for help on using the repository browser.