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

Last change on this file since 3115 was 3115, checked in by ansari, 19 years ago

Creation initiale du groupe Cosmo avec le repertoire SimLSS de
simulation de distribution de masse 3D des galaxies par CMV+Rz
18/12/2006

File size: 2.6 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
38 void ComputeFourier0(void);
39 void ComputeFourier(void);
40 void FilterByPixel(void);
41 int ComputeSpectrum(HProf& hp);
42 void ComputeReal(void);
43 void ReComputeFourier(void);
44
45 size_t VarianceFrReal(double R,double& var);
46 size_t MeanSigma2(double& rm,double& rs2,double vmin=-1.e+150,double vmax=1.e+150);
47 size_t NumberOfBad(double vmin=-1.e+150,double vmax=1.e+150);
48 size_t SetToVal(double vmin, double vmax,double val0=0.);
49
50 void TurnFluct2Mass(void);
51 double TurnMass2MeanNumber(double n_by_mpc3);
52 double ApplyPoisson(void);
53 double TurnNGal2Mass(FunRan& massdist,bool axeslog=false);
54 double TurnMass2Flux(void);
55 void AddNoise2Real(double snoise);
56
57 void Print(void);
58
59protected:
60 int manage_coefficients(void);
61 double compute_power_carte(void);
62 inline double pixelfilter(double kx)
63 {return (kx<0.05) ? 1.-kx*kx/12.*(1.-kx*kx/30.): 2.*(1.-cos(kx))/(kx*kx);}
64
65
66 int Nx_,Ny_,Nz_,SzK_[3];
67 int NCz_,NTz_;
68 size_t NRtot_;
69 double Dx_,Dy_,Dz_;
70 double dVol_, Vol_;
71 double Dkx_,Dky_,Dkz_;
72 double Knyqx_,Knyqy_,Knyqz_;
73 double Dk3_;
74
75 fftw_plan pf_,pb_;
76 unsigned short nthread_;
77
78 // = 0 : T_ vide
79 // = 1 : T_ contient une realisation du spectre (espace fourier)
80 // = 2 : T_ contient une realisation dans l'espace reel
81 // = 3 : T_ contient la TF d'une realisation dans l'espace reel (d_rho/rho)
82 // = 4 : T_ contient (1 + d_rho/rho)
83 // = ... etc ...
84 unsigned short Tcontent_;
85
86 TArray< complex<r_8 > >& T_;
87 PkSpectrumZ& pkz_;
88};
89
90} // Fin du namespace
91
92#endif
Note: See TracBrowser for help on using the repository browser.