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

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

passage int en long aux endroits importants cmv 11/01/07

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(long nx,long ny,long 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 long 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 long Nx_,Ny_,Nz_;
71 sa_size_t SzK_[3];
72 long NCz_,NTz_;
73 size_t NRtot_;
74 double Dx_,Dy_,Dz_;
75 double dVol_, Vol_;
76 double Dkx_,Dky_,Dkz_;
77 double Knyqx_,Knyqy_,Knyqz_;
78 double Dk3_;
79
80 fftw_plan pf_,pb_;
81 unsigned short nthread_;
82
83 // = 0 : T_ vide
84 // = 1 : T_ contient une realisation du spectre (espace fourier)
85 // = 2 : T_ contient une realisation dans l'espace reel
86 // = 3 : T_ contient la TF d'une realisation dans l'espace reel (d_rho/rho)
87 // = 4 : T_ contient (1 + d_rho/rho)
88 // = ... etc ...
89 unsigned short Tcontent_;
90
91 TArray< complex<r_8 > >& T_;
92 PkSpectrumZ& pkz_;
93};
94
95} // Fin du namespace
96
97#endif
Note: See TracBrowser for help on using the repository browser.