source: Sophya/trunk/Cosmo/SimLSS/genefluct3d.h@ 3120

Last change on this file since 3120 was 3120, checked in by cmv, 19 years ago

Suite de la mise dans la base cvs cmv 21/12/2006

File size: 2.8 KB
Line 
1#ifndef GENEFLUCT3D_SEEN
2#define GENEFLUCT3D_SEEN
3
4#include "machdefs.h"
5#include "genericfunc.h"
6#include "tarray.h"
7#include "hisprof.h"
8#include "perandom.h"
9
10#include <vector>
11
12#include "pkspectrum.h"
13
14#include "FFTW/fftw3.h"
15
16namespace SOPHYA {
17
18//-----------------------------------------------------------------------------------
19class GeneFluct3D {
20public:
21 GeneFluct3D(TArray< complex<r_8 > >& T,PkSpectrumZ& pkz);
22 virtual ~GeneFluct3D(void);
23
24 void SetNThread(unsigned short nthread=0) {nthread_ = nthread;}
25 void SetSize(int nx,int ny,int nz,double dx,double dy,double dz); // Mpc
26
27 inline void SetZ(double z) {pkz_.SetZ(z);}
28 double GetZ(void) {return pkz_.GetZ();}
29 double GetVol(void) {return Vol_;}
30 double GetDVol(void) {return dVol_;}
31 size_t NPix(void) {return NRtot_;}
32 double GetKmax(void) {return sqrt(Knyqx_*Knyqx_+Knyqy_*Knyqy_+Knyqz_*Knyqz_);}
33 vector<r_8> GetKinc(void)
34 {vector<r_8> dk; dk.push_back(Dkx_); dk.push_back(Dky_); dk.push_back(Dkz_); return dk;}
35 vector<r_8> GetKnyq(void)
36 {vector<r_8> kn; kn.push_back(Knyqx_); kn.push_back(Knyqy_); kn.push_back(Knyqz_); return kn;}
37 vector<r_8> GetDinc(void)
38 {vector<r_8> d; d.push_back(Dx_); d.push_back(Dy_); d.push_back(Dz_); return d;}
39 vector<long> GetNpix(void)
40 {vector<long> d; d.push_back(Nx_); d.push_back(Ny_); d.push_back(Nz_); return d;}
41
42 void ComputeFourier0(void);
43 void ComputeFourier(void);
44 void FilterByPixel(void);
45 int ComputeSpectrum(HProf& hp);
46 void ComputeReal(void);
47 void ReComputeFourier(void);
48
49 size_t VarianceFrReal(double R,double& var);
50 size_t MeanSigma2(double& rm,double& rs2,double vmin=-1.e+150,double vmax=1.e+150);
51 size_t NumberOfBad(double vmin=-1.e+150,double vmax=1.e+150);
52 size_t SetToVal(double vmin, double vmax,double val0=0.);
53
54 void TurnFluct2Mass(void);
55 double TurnMass2MeanNumber(double n_by_mpc3);
56 double ApplyPoisson(void);
57 double TurnNGal2Mass(FunRan& massdist,bool axeslog=false);
58 double TurnMass2Flux(void);
59 void AddNoise2Real(double snoise);
60
61 void Print(void);
62
63protected:
64 int manage_coefficients(void);
65 double compute_power_carte(void);
66 inline double pixelfilter(double x)
67 {return (x<0.025) ? 1.-x*x/6.*(1.-x*x/20.): sin(x)/x;}
68
69
70 int Nx_,Ny_,Nz_,SzK_[3];
71 int NCz_,NTz_;
72 size_t NRtot_;
73 double Dx_,Dy_,Dz_;
74 double dVol_, Vol_;
75 double Dkx_,Dky_,Dkz_;
76 double Knyqx_,Knyqy_,Knyqz_;
77 double Dk3_;
78
79 fftw_plan pf_,pb_;
80 unsigned short nthread_;
81
82 // = 0 : T_ vide
83 // = 1 : T_ contient une realisation du spectre (espace fourier)
84 // = 2 : T_ contient une realisation dans l'espace reel
85 // = 3 : T_ contient la TF d'une realisation dans l'espace reel (d_rho/rho)
86 // = 4 : T_ contient (1 + d_rho/rho)
87 // = ... etc ...
88 unsigned short Tcontent_;
89
90 TArray< complex<r_8 > >& T_;
91 PkSpectrumZ& pkz_;
92};
93
94} // Fin du namespace
95
96#endif
Note: See TracBrowser for help on using the repository browser.