Changeset 473 in Sophya for trunk/SophyaLib/Samba/spheregorski.cc
- Timestamp:
- Oct 18, 1999, 4:37:44 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Samba/spheregorski.cc
r470 r473 1 //2 1 #include "spheregorski.h" 3 2 #include "strutil.h" … … 14 13 extern "C" 15 14 { 16 void anafast_(int&, int&,int&,double&,float*,float*,float*,float*,float*,float*,float*);17 void synfast_(int&, int&, int&,int&, float&,float*,float*,float*,double*,double*,double*,double*,double*,float*);15 void anafast_(int&,int&,int&,double&,float*,float*,float*,float*,float*,float*,float*); 16 void synfast_(int&,int&,int&,int&,float&,float*,float*,float*,double*,double*,double*,double*,double*,float*); 18 17 } 19 18 20 19 //******************************************************************* 21 20 // Class PIXELS_XY 22 // 23 // 21 // Construction des tableaux necessaires a la traduction des indices RING en 22 // indices NESTED (ou l'inverse) 24 23 //******************************************************************* 25 24 … … 57 56 c one breaks up the pixel number by even and odd bits 58 57 ================================================== 59 58 */ 60 59 // tranlated from FORTRAN (Gorski) to C, by B. Revenu, revised Guy Le Meur 61 60 // (16/12/98) … … 101 100 c ix + iy in {0, 128**2 -1} 102 101 ================================================= 103 102 */ 104 103 // tranlated from FORTRAN (Gorski) to C, by B. Revenu, revised Guy Le Meur 105 104 // (16/12/98) … … 196 195 //++ 197 196 template<class T> 198 SphereGorski<T>::SphereGorski(int _4m)197 SphereGorski<T>::SphereGorski(int m) 199 198 200 199 // Constructeur : m est la variable nside de l'algorithme de Gorski … … 211 210 } 212 211 // verifier que m est une puissance de deux 213 int _4 x=m;212 int x= m; 214 213 while(x%2 == 0) x/=2; 215 214 if(x != 1) … … 261 260 //++ 262 261 template<class T> 263 void SphereGorski<T>::Resize(int _4m)262 void SphereGorski<T>::Resize(int m) 264 263 265 264 // m est la variable nside de l'algorithme de Gorski … … 273 272 } 274 273 // verifier que m est une puissance de deux 275 int _4 x=m;274 int x= m; 276 275 while (x%2==0) x/=2; 277 276 if(x != 1) … … 285 284 286 285 template<class T> 287 void SphereGorski<T>::Pixelize( int _4m)286 void SphereGorski<T>::Pixelize( int m) 288 287 289 288 // prépare la pixelisation Gorski (m a la même signification … … 294 293 { 295 294 // On memorise les arguments d'appel 296 nSide_ 295 nSide_= m; 297 296 298 297 // Nombre total de pixels sur la sphere entiere 299 nPix_= 12*nSide_*nSide_;298 nPix_= 12*nSide_*nSide_; 300 299 301 300 // pour le moment les tableaux qui suivent seront ranges dans l'ordre … … 310 309 311 310 // solid angle per pixel 312 omeg_= 4 *Pi/nPix_;311 omeg_= 4.0*Pi/nPix_; 313 312 } 314 313 … … 335 334 //++ 336 335 template<class T> 337 int _4SphereGorski<T>::NbPixels() const336 int SphereGorski<T>::NbPixels() const 338 337 339 338 // Retourne le nombre de pixels du découpage … … 345 344 //++ 346 345 template<class T> 347 int _4SphereGorski<T>::NbThetaSlices() const346 int SphereGorski<T>::NbThetaSlices() const 348 347 349 348 // Retourne le nombre de tranches en theta sur la sphere 350 349 //-- 351 350 { 352 return int _4(4*nSide_-1);353 } 354 355 //++ 356 template<class T> 357 void SphereGorski<T>::GetThetaSlice(int_4 index, r_4& theta, TVector<float>& phi,TVector<T>& value) const351 return int(4*nSide_-1); 352 } 353 354 //++ 355 template<class T> 356 void SphereGorski<T>::GetThetaSlice(int index,double& theta,TVector<double>& phi,TVector<T>& value) const 358 357 359 358 // Retourne, pour la tranche en theta d'indice 'index' le theta … … 372 371 } 373 372 374 int _4iring= 0;373 int iring= 0; 375 374 int lring = 0; 376 375 if(index < nSide_-1) … … 393 392 phi.ReSize(lring); 394 393 value.ReSize(lring); 395 float TH=0.;396 float F =0.;394 double TH= 0.; 395 double FI= 0.; 397 396 for(int kk = 0; kk < lring;kk++) 398 397 { 399 PixThetaPhi(kk+iring,TH,F );400 phi(kk)= F ;398 PixThetaPhi(kk+iring,TH,FI); 399 phi(kk)= FI; 401 400 value(kk)= PixVal(kk+iring); 402 401 } … … 407 406 //++ 408 407 template<class T> 409 T& SphereGorski<T>::PixVal(int _4k)408 T& SphereGorski<T>::PixVal(int k) 410 409 411 410 // Retourne la valeur du contenu du pixel d'indice "RING" k … … 424 423 //++ 425 424 template<class T> 426 T const& SphereGorski<T>::PixVal(int _4k) const425 T const& SphereGorski<T>::PixVal(int k) const 427 426 428 427 // Retourne la valeur du contenu du pixel d'indice "RING" k … … 440 439 //++ 441 440 template<class T> 442 T& SphereGorski<T>::PixValNest(int _4k)441 T& SphereGorski<T>::PixValNest(int k) 443 442 444 443 // Retourne la valeur du contenu du pixel d'indice "NESTED" k … … 456 455 457 456 template<class T> 458 T const& SphereGorski<T>::PixValNest(int _4k) const457 T const& SphereGorski<T>::PixValNest(int k) const 459 458 460 459 // Retourne la valeur du contenu du pixel d'indice "NESTED" k … … 467 466 THROW(rangeCheckErr); 468 467 } 469 int _4pix= nest2ring(nSide_,k);468 int pix= nest2ring(nSide_,k); 470 469 return *(pixels_.Data()+pix); 471 470 } … … 474 473 //++ 475 474 template<class T> 476 int _4 SphereGorski<T>::PixIndexSph(r_4 theta, r_4phi) const475 int SphereGorski<T>::PixIndexSph(double theta,double phi) const 477 476 478 477 // Retourne l'indice "RING" du pixel vers lequel pointe une direction … … 480 479 //-- 481 480 { 482 return ang2pix_ring(nSide_, double(theta),double(phi));483 } 484 485 //++ 486 template<class T> 487 int _4 SphereGorski<T>::PixIndexSphNest(r_4 theta, r_4phi) const481 return ang2pix_ring(nSide_,theta,phi); 482 } 483 484 //++ 485 template<class T> 486 int SphereGorski<T>::PixIndexSphNest(double theta,double phi) const 488 487 489 488 // Retourne l'indice NESTED" du pixel vers lequel pointe une direction … … 491 490 //-- 492 491 { 493 return ang2pix_nest(nSide_, double(theta),double(phi));492 return ang2pix_nest(nSide_,theta,phi); 494 493 } 495 494 … … 498 497 //++ 499 498 template<class T> 500 void SphereGorski<T>::PixThetaPhi(int_4 k, r_4& teta, r_4& phi) const 501 502 // Retourne les coordonnées (teta,phi) du milieu du pixel d'indice "RING" k 503 //-- 504 { 505 double t; 506 double p; 507 pix2ang_ring(nSide_,k, t, p); 508 teta= (r_4)t; 509 phi = (r_4)p; 510 } 511 512 //++ 513 template<class T> 514 r_8 SphereGorski<T>::PixSolAngle(int_4 dummy) const 499 void SphereGorski<T>::PixThetaPhi(int k,double& theta,double& phi) const 500 501 // Retourne les coordonnées (theta,phi) du milieu du pixel d'indice "RING" k 502 //-- 503 { 504 pix2ang_ring(nSide_,k,theta,phi); 505 } 506 507 //++ 508 template<class T> 509 double SphereGorski<T>::PixSolAngle(int dummy) const 515 510 // Pixel Solid angle (steradians) 516 511 // All the pixels have the same solid angle. The dummy argument is … … 524 519 //++ 525 520 template<class T> 526 void SphereGorski<T>::PixThetaPhiNest(int _4 k, float& teta, float& phi)const527 528 // Retourne les coordonnées (t eta,phi) du milieu du pixel d'indice521 void SphereGorski<T>::PixThetaPhiNest(int k,double& theta,double& phi) const 522 523 // Retourne les coordonnées (theta,phi) du milieu du pixel d'indice 529 524 // NESTED k 530 525 //-- 531 526 { 532 double t; 533 double p; 534 pix2ang_nest(nSide_, k, t, p); 535 teta= (r_4)t; 536 phi = (r_4)p; 537 } 538 539 //++ 540 template<class T> 541 int_4 SphereGorski<T>::NestToRing(int_4 k) const 527 pix2ang_nest(nSide_,k,theta,phi); 528 } 529 530 //++ 531 template<class T> 532 int SphereGorski<T>::NestToRing(int k) const 542 533 543 534 // conversion d'index NESTD en un index RING … … 550 541 //++ 551 542 template<class T> 552 int _4 SphereGorski<T>::RingToNest(int_4k) const543 int SphereGorski<T>::RingToNest(int k) const 553 544 // 554 545 // conversion d'index RING en un index NESTED … … 687 678 688 679 template<class T> 689 int SphereGorski<T>::nest2ring(int nside, int ipnest) const { 680 int SphereGorski<T>::nest2ring(int nside, int ipnest) const 681 { 690 682 /* 691 683 ==================================================== … … 694 686 c conversion from NESTED to RING pixel number 695 687 ==================================================== 696 688 */ 697 689 // tranlated from FORTRAN (Gorski) to C, by B. Revenu, revised Guy Le Meur 698 690 // (16/12/98) … … 776 768 c conversion from RING to NESTED pixel number 777 769 ================================================== 778 770 */ 779 771 // tranlated from FORTRAN (Gorski) to C, by B. Revenu, revised Guy Le Meur 780 772 // (16/12/98) … … 884 876 c corresponding to angles theta and phi 885 877 c================================================== 886 878 */ 887 879 // tranlated from FORTRAN (Gorski) to C, by B. Revenu, revised Guy Le Meur 888 880 // (16/12/98) … … 968 960 c for every resolution 969 961 ================================================== 970 962 */ 971 963 // tranlated from FORTRAN (Gorski) to C, by B. Revenu, revised Guy Le Meur 972 964 // (16/12/98) … … 1004 996 ifp = jp / ns_max;// ! in {0,4} 1005 997 ifm = jm / ns_max; 1006 if( ifp==ifm ) face_num = (int)fmod(ifp,4) + 4; //then 998 if( ifp==ifm ) face_num = (int)fmod(ifp,4) + 4; //then ! faces 4 to 7 1007 999 else if( ifp<ifm ) face_num = (int)fmod(ifp,4); // (half-)faces 0 to 3 1008 1000 else face_num = (int)fmod(ifm,4) + 8;//! (half-)faces 8 to 11 … … 1053 1045 c for a parameter nside 1054 1046 =================================================== 1055 1047 */ 1056 1048 // tranlated from FORTRAN (Gorski) to C, by B. Revenu, revised Guy Le Meur 1057 1049 // (16/12/98) … … 1123 1115 c for a parameter nside 1124 1116 ================================================== 1125 1117 */ 1126 1118 // tranlated from FORTRAN (Gorski) to C, by B. Revenu, revised Guy Le Meur 1127 1119 // (16/12/98) … … 1227 1219 1228 1220 template<class T> 1229 void SphereGorski<T>::getParafast(int _4& nlmax,int_4& nmmax,int_4& iseed,float& fwhm,float& quadr,float& cut) const1221 void SphereGorski<T>::getParafast(int& nlmax,int& nmmax,int& iseed,float& fwhm,float& quadr,float& cut) const 1230 1222 { 1231 1223 nlmax= nlmax_; … … 1238 1230 1239 1231 template<class T> 1240 void SphereGorski<T>::setParafast(int _4 nlmax,int_4 nmmax,int_4iseed,float fwhm,float quadr,float cut,char* filename)1232 void SphereGorski<T>::setParafast(int nlmax,int nmmax,int iseed,float fwhm,float quadr,float cut,char* filename) 1241 1233 { 1242 1234 nlmax_= nlmax; … … 1348 1340 } 1349 1341 1350 int _4nSide;1342 int nSide; 1351 1343 is.GetI4(nSide); 1352 1344 dobj->setSizeIndex(nSide); 1353 1345 1354 int _4nPix;1346 int nPix; 1355 1347 is.GetI4(nPix); 1356 1348 dobj->setNbPixels(nPix); 1357 1349 1358 r_8Omega;1350 double Omega; 1359 1351 is.GetR8(Omega); 1360 1352 dobj->setPixSolAngle(Omega); … … 1365 1357 delete [] pixels; 1366 1358 1367 int _4nlmax,nmmax,iseed;1359 int nlmax,nmmax,iseed; 1368 1360 is.GetI4(nlmax); 1369 1361 is.GetI4(nmmax); … … 1393 1385 1394 1386 char strg[256]; 1395 int _4nSide= dobj->SizeIndex();1396 int _4nPix = dobj->NbPixels();1387 int nSide= dobj->SizeIndex(); 1388 int nPix = dobj->NbPixels(); 1397 1389 1398 1390 if(dobj->ptrInfo()) … … 1414 1406 PIOSWriteArray(os,(dobj->getDataBlock())->Data(), nPix); 1415 1407 1416 int _4nlmax,nmmax,iseed;1408 int nlmax,nmmax,iseed; 1417 1409 float fwhm,quadr,cut; 1418 1410 dobj->getParafast(nlmax,nmmax,iseed,fwhm,quadr,cut);
Note:
See TracChangeset
for help on using the changeset viewer.