Changeset 3320 in Sophya for trunk/Cosmo/SimLSS/genefluct3d.cc


Ignore:
Timestamp:
Sep 5, 2007, 9:58:05 AM (18 years ago)
Author:
cmv
Message:

intro SchechterMassDist pour accelerer la simulations cmv 05/09/2007

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cosmo/SimLSS/genefluct3d.cc

    r3289 r3320  
    940940}
    941941
     942int_8 GeneFluct3D::MinMax(double& xmin,double& xmax,double vmin,double vmax)
     943// Calcul des valeurs xmin et xmax dans le cube reel avec valeurs ]vmin,vmax[ extremites exclues
     944{
     945 bool tstval = (vmax>vmin)? true: false;
     946 if(lp_>0) {
     947   cout<<"--- MinMax";
     948   if(tstval) cout<<"  range=]"<<vmin<<","<<vmax<<"[";
     949   cout<<endl;
     950 }
     951 check_array_alloc();
     952
     953 int_8 n = 0;
     954 xmin = xmax = data_[0];
     955
     956 for(long i=0;i<Nx_;i++) for(long j=0;j<Ny_;j++) for(long l=0;l<Nz_;l++) {
     957   int_8 ip = IndexR(i,j,l);
     958   double x = data_[ip];
     959   if(tstval && (x<=vmin || x>=vmax)) continue;
     960   if(x<xmin) xmin = x;
     961   if(x>xmax) xmax = x;
     962   n++;
     963 }
     964
     965 if(lp_>0) cout<<"  n="<<n<<" min="<<xmin<<" max="<<xmax<<endl;
     966
     967 return n;
     968}
     969
    942970int_8 GeneFluct3D::MeanSigma2(double& rm,double& rs2,double vmin,double vmax
    943971                             ,bool useout,double vout)
     
    11141142       data_[ip] += m;
    11151143     }
     1144     sum += data_[ip];
     1145   }
     1146 }
     1147 if(lp_>0) cout<<sum<<" MSol HI mass put into survey"<<endl;
     1148
     1149 return sum;
     1150}
     1151
     1152double GeneFluct3D::TurnNGal2MassQuick(SchechterMassDist& schmdist)
     1153// idem TurnNGal2Mass mais beaucoup plus rapide
     1154{
     1155 if(lp_>0) cout<<"--- TurnNGal2MassQuick ---"<<endl;
     1156 check_array_alloc();
     1157
     1158 double sum = 0.;
     1159 for(long i=0;i<Nx_;i++) for(long j=0;j<Ny_;j++) for(long l=0;l<Nz_;l++) {
     1160   int_8 ip = IndexR(i,j,l);
     1161   double v = data_[ip];
     1162   if(v>0.) {
     1163     long ngal = long(v+0.1);
     1164     data_[ip] = schmdist.TirMass(ngal);
    11161165     sum += data_[ip];
    11171166   }
Note: See TracChangeset for help on using the changeset viewer.