Changeset 853 in Sophya for trunk/SophyaLib/SkyMap/spherehealpix.cc
- Timestamp:
- Apr 10, 2000, 3:01:22 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SkyMap/spherehealpix.cc
r843 r853 126 126 //******************************************************************* 127 127 //++ 128 // Class SphereH ealpix128 // Class SphereHEALPix 129 129 // 130 130 // include SphereHealpix.h strutil.h … … 177 177 178 178 template<class T> 179 SphereH ealpix<T>::SphereHealpix()179 SphereHEALPix<T>::SphereHEALPix() 180 180 181 181 //-- … … 187 187 //++ 188 188 template<class T> 189 SphereH ealpix<T>::SphereHealpix(int_4 m)189 SphereHEALPix<T>::SphereHEALPix(int_4 m) 190 190 191 191 // m is the "nside" of the Gorski algorithm … … 199 199 if(m <= 0 || m > 8192) 200 200 { 201 cout << "SphereH ealpix : m hors bornes [0,8192], m= " << m << endl;202 throw RangeCheckError("SphereH ealpix<T>::SphereHealpix() - Out of bound nside (< 8192)!");201 cout << "SphereHEALPix : m hors bornes [0,8192], m= " << m << endl; 202 throw RangeCheckError("SphereHEALPix<T>::SphereHEALPix() - Out of bound nside (< 8192)!"); 203 203 } 204 204 // verifier que m est une puissance de deux … … 207 207 if(x != 1) 208 208 { 209 cout<<"SphereH ealpix: m doit etre une puissance de deux, m= "<<m<<endl;210 throw ParmError("SphereH ealpix<T>::SphereHealpix() - nside != 2^n !");209 cout<<"SphereHEALPix: m doit etre une puissance de deux, m= "<<m<<endl; 210 throw ParmError("SphereHEALPix<T>::SphereHEALPix() - nside != 2^n !"); 211 211 } 212 212 InitNul(); … … 216 216 //++ 217 217 template<class T> 218 SphereH ealpix<T>::SphereHealpix(const SphereHealpix<T>& s, bool share)218 SphereHEALPix<T>::SphereHEALPix(const SphereHEALPix<T>& s, bool share) 219 219 : pixels_(s.pixels_, share), sliceBeginIndex_(s.sliceBeginIndex_, share), 220 220 sliceLenght_(s.sliceLenght_, share) … … 234 234 //++ 235 235 template<class T> 236 SphereH ealpix<T>::~SphereHealpix()236 SphereHEALPix<T>::~SphereHEALPix() 237 237 238 238 //-- … … 246 246 //++ 247 247 template<class T> 248 void SphereH ealpix<T>::Resize(int_4 m)248 void SphereHEALPix<T>::Resize(int_4 m) 249 249 250 250 // m is the "nside" of the Gorski algorithm … … 256 256 { 257 257 if (m<=0 || m> 8192) { 258 cout << "SphereH ealpix : m hors bornes [0,8192], m= " << m << endl;258 cout << "SphereHEALPix : m hors bornes [0,8192], m= " << m << endl; 259 259 exit(1); 260 260 } … … 264 264 if(x != 1) 265 265 { 266 cout<<"SphereH ealpix: m doit etre une puissance de deux, m= "<<m<<endl;266 cout<<"SphereHEALPix: m doit etre une puissance de deux, m= "<<m<<endl; 267 267 exit(1); 268 268 } … … 273 273 274 274 template<class T> 275 void SphereH ealpix<T>::Pixelize( int_4 m)275 void SphereHEALPix<T>::Pixelize( int_4 m) 276 276 277 277 // prépare la pixelisation Gorski (m a la même signification … … 301 301 302 302 template<class T> 303 void SphereH ealpix<T>::InitNul()303 void SphereHEALPix<T>::InitNul() 304 304 // 305 305 // initialise à zéro les variables de classe … … 314 314 //++ 315 315 template<class T> 316 int_4 SphereH ealpix<T>::NbPixels() const316 int_4 SphereHEALPix<T>::NbPixels() const 317 317 318 318 // Retourne le nombre de pixels du découpage … … 324 324 //++ 325 325 template<class T> 326 uint_4 SphereH ealpix<T>::NbThetaSlices() const326 uint_4 SphereHEALPix<T>::NbThetaSlices() const 327 327 328 328 // Return number of slices in theta direction on the sphere … … 340 340 //++ 341 341 template<class T> 342 void SphereH ealpix<T>::GetThetaSlice(int_4 index,r_8& theta,TVector<r_8>& phi,TVector<T>& value) const342 void SphereHEALPix<T>::GetThetaSlice(int_4 index,r_8& theta,TVector<r_8>& phi,TVector<T>& value) const 343 343 344 344 // For a theta-slice with index 'index', return : … … 355 355 if (index<0 || index >= NbThetaSlices()) 356 356 { 357 // THROW(out_of_range("SphereH ealpix::PIxVal Pixel index out of range"));358 cout << " SphereH ealpix::GetThetaSlice : Pixel index out of range" <<endl;359 throw RangeCheckError(" SphereH ealpix::GetThetaSlice : Pixel index out of range");357 // THROW(out_of_range("SphereHEALPix::PIxVal Pixel index out of range")); 358 cout << " SphereHEALPix::GetThetaSlice : Pixel index out of range" <<endl; 359 throw RangeCheckError(" SphereHEALPix::GetThetaSlice : Pixel index out of range"); 360 360 } 361 361 … … 381 381 382 382 template<class T> 383 void SphereH ealpix<T>::GetThetaSlice(int_4 sliceIndex,r_8& theta, r_8& phi0, TVector<int_4>& pixelIndices,TVector<T>& value) const383 void SphereHEALPix<T>::GetThetaSlice(int_4 sliceIndex,r_8& theta, r_8& phi0, TVector<int_4>& pixelIndices,TVector<T>& value) const 384 384 385 385 // For a theta-slice with index 'sliceIndex', return : … … 398 398 if (sliceIndex<0 || sliceIndex >= NbThetaSlices()) 399 399 { 400 // THROW(out_of_range("SphereH ealpix::PIxVal Pixel index out of range"));401 cout << " SphereH ealpix::GetThetaSlice : Pixel index out of range" <<endl;402 throw RangeCheckError(" SphereH ealpix::GetThetaSlice : Pixel index out of range");400 // THROW(out_of_range("SphereHEALPix::PIxVal Pixel index out of range")); 401 cout << " SphereHEALPix::GetThetaSlice : Pixel index out of range" <<endl; 402 throw RangeCheckError(" SphereHEALPix::GetThetaSlice : Pixel index out of range"); 403 403 } 404 404 int_4 iring= sliceBeginIndex_(sliceIndex); … … 416 416 //++ 417 417 template<class T> 418 void SphereH ealpix<T>::SetThetaSlices()418 void SphereHEALPix<T>::SetThetaSlices() 419 419 420 420 //-- … … 443 443 //++ 444 444 template<class T> 445 T& SphereH ealpix<T>::PixVal(int_4 k)445 T& SphereHEALPix<T>::PixVal(int_4 k) 446 446 447 447 // Return value of pixel with "RING" index k … … 450 450 if((k < 0) || (k >= nPix_)) 451 451 { 452 throw RangeCheckError("SphereH ealpix::PIxVal Pixel index out of range");452 throw RangeCheckError("SphereHEALPix::PIxVal Pixel index out of range"); 453 453 } 454 454 return pixels_(k); … … 458 458 //++ 459 459 template<class T> 460 T const& SphereH ealpix<T>::PixVal(int_4 k) const460 T const& SphereHEALPix<T>::PixVal(int_4 k) const 461 461 462 462 // Return value of pixel with "RING" index k … … 465 465 if((k < 0) || (k >= nPix_)) 466 466 { 467 throw RangeCheckError("SphereH ealpix::PIxVal Pixel index out of range");467 throw RangeCheckError("SphereHEALPix::PIxVal Pixel index out of range"); 468 468 } 469 469 return *(pixels_.Data()+k); … … 472 472 //++ 473 473 template<class T> 474 T& SphereH ealpix<T>::PixValNest(int_4 k)474 T& SphereHEALPix<T>::PixValNest(int_4 k) 475 475 476 476 // Return value of pixel with "NESTED" index k … … 479 479 if((k < 0) || (k >= nPix_)) 480 480 { 481 throw RangeCheckError("SphereH ealpix::PIxValNest Pixel index out of range");481 throw RangeCheckError("SphereHEALPix::PIxValNest Pixel index out of range"); 482 482 } 483 483 return pixels_(nest2ring(nSide_,k)); … … 486 486 487 487 template<class T> 488 T const& SphereH ealpix<T>::PixValNest(int_4 k) const488 T const& SphereHEALPix<T>::PixValNest(int_4 k) const 489 489 490 490 // Return value of pixel with "NESTED" index k … … 493 493 if((k < 0) || (k >= nPix_)) 494 494 { 495 throw RangeCheckError("SphereH ealpix::PIxValNest Pixel index out of range");495 throw RangeCheckError("SphereHEALPix::PIxValNest Pixel index out of range"); 496 496 } 497 497 int_4 pix= nest2ring(nSide_,k); … … 502 502 //++ 503 503 template<class T> 504 bool SphereH ealpix<T>::ContainsSph(double /*theta*/, double /*phi*/) const504 bool SphereHEALPix<T>::ContainsSph(double /*theta*/, double /*phi*/) const 505 505 //-- 506 506 { … … 511 511 //++ 512 512 template<class T> 513 int_4 SphereH ealpix<T>::PixIndexSph(double theta,double phi) const513 int_4 SphereHEALPix<T>::PixIndexSph(double theta,double phi) const 514 514 515 515 // Return "RING" index of the pixel corresponding to … … 522 522 //++ 523 523 template<class T> 524 int_4 SphereH ealpix<T>::PixIndexSphNest(double theta,double phi) const524 int_4 SphereHEALPix<T>::PixIndexSphNest(double theta,double phi) const 525 525 526 526 // Return "NESTED" index of the pixel corresponding to … … 535 535 //++ 536 536 template<class T> 537 void SphereH ealpix<T>::PixThetaPhi(int_4 k,double& theta,double& phi) const537 void SphereHEALPix<T>::PixThetaPhi(int_4 k,double& theta,double& phi) const 538 538 539 539 // Return (theta,phi) coordinates of middle of pixel with "RING" index k … … 544 544 545 545 template <class T> 546 T SphereH ealpix<T>::SetPixels(T v)546 T SphereHEALPix<T>::SetPixels(T v) 547 547 { 548 548 pixels_.Reset(v); … … 552 552 //++ 553 553 template<class T> 554 double SphereH ealpix<T>::PixSolAngle(int_4 /*dummy*/) const554 double SphereHEALPix<T>::PixSolAngle(int_4 /*dummy*/) const 555 555 // Pixel Solid angle (steradians) 556 556 // All the pixels have the same solid angle. The dummy argument is … … 564 564 //++ 565 565 template<class T> 566 void SphereH ealpix<T>::PixThetaPhiNest(int_4 k,double& theta,double& phi) const566 void SphereHEALPix<T>::PixThetaPhiNest(int_4 k,double& theta,double& phi) const 567 567 568 568 // Return (theta,phi) coordinates of middle of pixel with "NESTED" index k … … 574 574 //++ 575 575 template<class T> 576 int_4 SphereH ealpix<T>::NestToRing(int_4 k) const576 int_4 SphereHEALPix<T>::NestToRing(int_4 k) const 577 577 578 578 // translation from NESTED index into RING index … … 585 585 //++ 586 586 template<class T> 587 int_4 SphereH ealpix<T>::RingToNest(int_4 k) const587 int_4 SphereHEALPix<T>::RingToNest(int_4 k) const 588 588 // 589 589 // translation from RING index into NESTED index … … 596 596 597 597 template<class T> 598 int_4 SphereH ealpix<T>::nest2ring(int_4 nside, int_4 ipnest) const598 int_4 SphereHEALPix<T>::nest2ring(int_4 nside, int_4 ipnest) const 599 599 { 600 600 /* … … 678 678 679 679 template<class T> 680 int_4 SphereH ealpix<T>::ring2nest(int_4 nside, int_4 ipring) const680 int_4 SphereHEALPix<T>::ring2nest(int_4 nside, int_4 ipring) const 681 681 { 682 682 /* … … 787 787 788 788 template<class T> 789 int_4 SphereH ealpix<T>::ang2pix_ring(int_4 nside, double theta, double phi) const789 int_4 SphereHEALPix<T>::ang2pix_ring(int_4 nside, double theta, double phi) const 790 790 { 791 791 /* … … 863 863 864 864 template<class T> 865 int_4 SphereH ealpix<T>::ang2pix_nest(int_4 nside, double theta, double phi) const865 int_4 SphereHEALPix<T>::ang2pix_nest(int_4 nside, double theta, double phi) const 866 866 { 867 867 /* … … 960 960 961 961 template<class T> 962 void SphereH ealpix<T>::pix2ang_ring(int_4 nside,int_4 ipix,double& theta,double& phi) const {962 void SphereHEALPix<T>::pix2ang_ring(int_4 nside,int_4 ipix,double& theta,double& phi) const { 963 963 /* 964 964 =================================================== … … 1028 1028 1029 1029 template<class T> 1030 void SphereH ealpix<T>::pix2ang_nest(int_4 nside,int_4 ipix,double& theta,double& phi) const {1030 void SphereHEALPix<T>::pix2ang_nest(int_4 nside,int_4 ipix,double& theta,double& phi) const { 1031 1031 /* 1032 1032 ================================================== … … 1119 1119 1120 1120 template <class T> 1121 void SphereH ealpix<T>::print(ostream& os) const1121 void SphereHEALPix<T>::print(ostream& os) const 1122 1122 { 1123 1123 if(mInfo_) os << " DVList Info= " << *mInfo_ << endl; … … 1152 1152 1153 1153 #ifdef __CXX_PRAGMA_TEMPLATES__ 1154 #pragma define_template SphereH ealpix<uint_2>1155 #pragma define_template SphereH ealpix<r_8>1156 #pragma define_template SphereH ealpix<r_4>1157 #pragma define_template SphereH ealpix< complex<r_4> >1158 #pragma define_template SphereH ealpix< complex<r_8> >1154 #pragma define_template SphereHEALPix<uint_2> 1155 #pragma define_template SphereHEALPix<r_8> 1156 #pragma define_template SphereHEALPix<r_4> 1157 #pragma define_template SphereHEALPix< complex<r_4> > 1158 #pragma define_template SphereHEALPix< complex<r_8> > 1159 1159 #endif 1160 1160 #if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES) 1161 template class SphereH ealpix<uint_2>;1162 template class SphereH ealpix<r_8>;1163 template class SphereH ealpix<r_4>;1164 template class SphereH ealpix< complex<r_4> >;1165 template class SphereH ealpix< complex<r_8> >;1161 template class SphereHEALPix<uint_2>; 1162 template class SphereHEALPix<r_8>; 1163 template class SphereHEALPix<r_4>; 1164 template class SphereHEALPix< complex<r_4> >; 1165 template class SphereHEALPix< complex<r_8> >; 1166 1166 #endif 1167 1167
Note:
See TracChangeset
for help on using the changeset viewer.