Changeset 3501 in Sophya for trunk/Cosmo/SimLSS/cmvsinxsx.cc
- Timestamp:
- Jul 18, 2008, 6:50:43 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cosmo/SimLSS/cmvsinxsx.cc
r3500 r3501 39 39 bool only_test = false; 40 40 double pr_test = 1.e99; 41 41 int nvec=0; 42 double veccent=0., vecmax = -2.; 43 44 //--- Read arguments 42 45 char c; 43 while((c = getopt(narg,arg,"htp:n: ")) != -1) {46 while((c = getopt(narg,arg,"htp:n:v:")) != -1) { 44 47 switch (c) { 45 48 case 'n' : … … 52 55 sscanf(optarg,"%lf",&pr_test); 53 56 break; 57 case 'v' : 58 sscanf(optarg,"%d,%lf",&nvec,&vecmax); 59 break; 54 60 case 'h' : 55 61 default : 56 cout<<"cmvsinxsx [-t] [-p eps_print] [-n N] [dt,tmin,tmax (rad)]"<<endl; 62 cout<<"cmvsinxsx [-t] [-p eps_print] [-n N] [-v nv,(+-)vmax (rad)]"<<endl; 63 cout<<" [dt,tmin,tmax (rad)]"<<endl; 57 64 return -1; 58 65 } … … 62 69 cout<<"N="<<N<<" dt="<<dt<<" tmin="<<tmin<<" tmax="<<tmax<<" rad"<<endl; 63 70 cout<<"only_test="<<only_test<<" pr_test="<<pr_test<<endl; 71 if(vecmax<0.) vecmax *= -M_PI; 72 cout<<"nv="<<nvec<<" vmax="<<vecmax<<" -> ["<<-vecmax/2<<","<<vecmax/2<<"]"<<endl; 64 73 if(tmax<=tmin) return -1; 65 74 75 //--- Create NTuple 66 76 const int nvar = 11; 67 77 char *vname[nvar] = {"t","s","sn","sx","sx2","snx","snx2","asx","asx2","asnx","asnx2"}; … … 69 79 NTuple nt(nvar,vname); 70 80 81 //--- Fill NTuple and do precision test 71 82 long n = 0; 72 83 double diffsx=0., diffsx2=0., diffsnx=0., diffsnx2=0.; … … 115 126 cout<<" (sNx/x)^2 = "<<diffsnx2<<" = "<<diffsnx2/(N*N)<<" * "<<N<<" * "<<N<<endl; 116 127 117 if(!only_test) { 118 cout<<"writing ppf"<<endl; 119 POutPersist pos("cmvsinxsx.ppf"); 120 pos.PutObject(nt,"nt"); 128 //--- Fill vector for FFT 129 TVector<r_8> vsx,vsx2,vsnx,vsnx2; 130 if(nvec>1) { 131 vsx.ReSize(nvec); vsx2.ReSize(nvec); vsnx.ReSize(nvec); vsnx2.ReSize(nvec); 132 for(int i=0;i<nvec;i++) { 133 double t = veccent -vecmax/2. + i*vecmax/(double)nvec; 134 vsx(i) = SinXsX(t); 135 vsx2(i) = SinXsX_Sqr(t); 136 vsnx(i) = SinNXsX(t,N); 137 vsnx2(i) = SinNXsX_Sqr(t,N); 138 } 121 139 } 140 141 //--- Write PPF 142 POutPersist pos("cmvsinxsx.ppf"); 143 if(!only_test) pos.PutObject(nt,"nt"); 144 if(vsx.Size()>0) pos.PutObject(vsx,"vsx"); 145 if(vsx2.Size()>0) pos.PutObject(vsx2,"vsx2"); 146 if(vsnx.Size()>0) pos.PutObject(vsnx,"vsnx"); 147 if(vsnx2.Size()>0) pos.PutObject(vsnx2,"vsnx2"); 122 148 123 149 return 0; … … 161 187 n/plot nt.snx2-asnx2%t ! ! "connectpoints" 162 188 189 #------- 190 openppf cmvsinxsx.ppf 191 192 zone 2 2 193 n/plot vsx.val%n ! ! 194 n/plot vsx2.val%n ! ! 195 n/plot vsnx.val%n ! ! 196 n/plot vsnx2.val%n ! ! 197 198 zone 199 fftforw vsx fvsx 200 fftforw vsx2 fvsx2 201 fftforw vsnx fvsnx 202 fftforw vsnx2 fvsnx2 203 204 zone 205 n/plot fvsx.val%n ! ! "connectpoints" 206 n/plot fvsx2.val%n ! ! "connectpoints" 207 n/plot fvsnx.val%n ! ! "connectpoints" 208 n/plot fvsnx2.val%n ! ! "connectpoints" 209 163 210 */
Note:
See TracChangeset
for help on using the changeset viewer.