Changeset 3318 in Sophya for trunk/Cosmo/SimLSS/pkspectrum.cc
- Timestamp:
- Aug 28, 2007, 11:41:49 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cosmo/SimLSS/pkspectrum.cc
r3314 r3318 65 65 zero_(); 66 66 Init_(); 67 } 68 69 void TransfertEisenstein::zero_(void) 70 { 71 th2p7_=zeq_=keq_=zd_=Req_=Rd_=s_=ksilk_=alphac_=betac_=bnode_ 72 =alphab_=betab_=alphag_=sfit_=kpeak_=1.e99; 67 73 } 68 74 … … 275 281 276 282 /////////////////////////////////////////////////////////// 283 //******************* TransfertTabulate *****************// 284 /////////////////////////////////////////////////////////// 285 286 TransfertTabulate::TransfertTabulate(double h100,double OmegaCDM0,double OmegaBaryon0) 287 : Oc_(OmegaCDM0) , Ob_(OmegaBaryon0) , h_(h100) , kmin_(1.) , kmax_(-1.) 288 , interptyp_(0) 289 { 290 } 291 292 TransfertTabulate::TransfertTabulate(TransfertTabulate& tf) 293 : Oc_(tf.Oc_) , Ob_(tf.Ob_) , h_(tf.h_) , kmin_(tf.kmin_) , kmax_(tf.kmax_) 294 , interptyp_(tf.interptyp_) , k_(tf.k_) , tf_(tf.tf_) 295 { 296 } 297 298 TransfertTabulate::~TransfertTabulate(void) 299 { 300 } 301 302 void TransfertTabulate::SetInterpTyp(int typ) 303 // see comment in InterpTab 304 { 305 if(typ<0) typ=0; else if(typ>2) typ=2; 306 interptyp_ = typ; 307 } 308 309 double TransfertTabulate::operator() (double k) 310 { 311 return InterpTab(k,k_,tf_,interptyp_); 312 } 313 314 int TransfertTabulate::ReadCMBFast(string filename) 315 { 316 FILE *file = fopen(filename.c_str(),"r"); 317 if(file==NULL) return -1; 318 319 const int lenline = 512; 320 char *line = new char[lenline]; 321 322 int nread = 0; 323 double tmax = -1.; 324 while ( fgets(line,lenline,file) != NULL ) { 325 double k,tc,tb,tf; 326 sscanf(line,"%lf %lf %lf",&k,&tc,&tb); 327 k *= h_; // convert h^-1 Mpc -> Mpc 328 tf = (Oc_*tc+Ob_*tb)/(Oc_+Ob_); 329 if(tf>tmax) tmax = tf; 330 k_.push_back(k); 331 tf_.push_back(tf); 332 nread++; 333 } 334 335 cout<<"TransfertTabulate::ReadCMBFast: nread="<<nread<<" tf_max="<<tmax<<endl; 336 delete [] line; 337 if(nread==0) return nread; 338 339 for(unsigned int i=0;i<tf_.size();i++) tf_[i] /= tmax; 340 341 return nread; 342 } 343 344 /////////////////////////////////////////////////////////// 277 345 //********************* GrowthFactor ********************// 278 346 ///////////////////////////////////////////////////////////
Note:
See TracChangeset
for help on using the changeset viewer.