- Timestamp:
- Feb 21, 2000, 12:23:25 PM (26 years ago)
- Location:
- trunk/SophyaLib/Samba
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Samba/spheregorski.cc
r701 r724 211 211 InitNul(); 212 212 Pixelize(m); 213 SetThetaSlices(); 213 214 } 214 215 //++ … … 268 269 InitNul(); 269 270 Pixelize(m); 271 SetThetaSlices(); 270 272 } 271 273 … … 322 324 //++ 323 325 template<class T> 324 int_4 SphereGorski<T>::NbThetaSlices() const326 uint_4 SphereGorski<T>::NbThetaSlices() const 325 327 326 328 // Return number of slices in theta direction on the sphere 327 329 //-- 328 330 { 329 return int(4*nSide_-1); 331 uint_4 nbslices = uint_4(4*nSide_-1); 332 if (nSide_<=0) 333 { 334 nbslices = 0; 335 throw PException(" sphere not pixelized, NbSlice=0 "); 336 } 337 return nbslices; 330 338 } 331 339 … … 352 360 } 353 361 354 int_4 iring= 0; 355 int_4 lring = 0; 356 if(index < nSide_-1) 357 { 358 iring= 2*index*(index+1); 359 lring= 4*(index+1); 360 } 361 else if(index < 3*nSide_) 362 { 363 iring= 2*nSide_*(2*index-nSide_+1); 364 lring= 4*nSide_; 365 } 366 else 367 { 368 int_4 nc= 4*nSide_-1-index; 369 iring = nPix_-2*nc*(nc+1); 370 lring = 4*nc; 371 } 362 363 int_4 iring= sliceBeginIndex_(index); 364 int_4 lring = sliceLenght_(index); 365 372 366 373 367 phi.ReSize(lring); … … 382 376 } 383 377 theta= TH; 378 } 379 //++ 380 //++ 381 382 template<class T> 383 void SphereGorski<T>::GetThetaSlice(int_4 sliceIndex,double& theta, double& phi0, TVector<int>& pixelIndices,TVector<T>& value) const 384 385 // For a theta-slice with index 'sliceIndex', return : 386 // 387 // the corresponding "theta" 388 // the corresponding "phi" for first pixel of the slice 389 // 390 // a vector containing the indices of the pixels of the slice 391 // (equally distributed in phi) 392 // 393 // a vector containing the corresponding values of pixels 394 // 395 //-- 396 { 397 398 if (sliceIndex<0 || sliceIndex >= NbThetaSlices()) 399 { 400 // THROW(out_of_range("SphereGorski::PIxVal Pixel index out of range")); 401 cout << " SphereGorski::GetThetaSlice : Pixel index out of range" <<endl; 402 THROW(rangeCheckErr); 403 } 404 405 int_4 iring= sliceBeginIndex_(sliceIndex); 406 int_4 lring = sliceLenght_(sliceIndex); 407 pixelIndices.ReSize(lring); 408 value.ReSize(lring); 409 for(int_4 kk = 0; kk < lring;kk++) 410 { 411 pixelIndices(kk)= kk+iring; 412 value(kk)= PixVal(kk+iring); 413 } 414 PixThetaPhi(iring, theta, phi0); 415 } 416 //++ 417 template<class T> 418 void SphereGorski<T>::SetThetaSlices() 419 420 //-- 421 { 422 sliceBeginIndex_.ReSize(4*nSide_-1); 423 sliceLenght_.ReSize(4*nSide_-1); 424 for (int sliceIndex=0; sliceIndex< nSide_-1; sliceIndex++) 425 { 426 sliceBeginIndex_(sliceIndex) = 2*sliceIndex*(sliceIndex+1); 427 sliceLenght_(sliceIndex) = 4*(sliceIndex+1); 428 } 429 for (int sliceIndex= nSide_-1; sliceIndex< 3*nSide_; sliceIndex++) 430 { 431 sliceBeginIndex_(sliceIndex) = 2*nSide_*(2*sliceIndex-nSide_+1); 432 sliceLenght_(sliceIndex) = 4*nSide_; 433 } 434 for (int sliceIndex= 3*nSide_; sliceIndex< 4*nSide_-1; sliceIndex++) 435 { 436 int_4 nc= 4*nSide_-1-sliceIndex; 437 sliceBeginIndex_(sliceIndex) = nPix_-2*nc*(nc+1); 438 sliceLenght_(sliceIndex) = 4*nc; 439 } 384 440 } 385 441 … … 1179 1235 dobj->setParameters(nSide,nPix, Omega); 1180 1236 1181 // On lit le DataBlock;1237 // On lit les DataBlocks; 1182 1238 FIO_NDataBlock<T> fio_nd(&dobj->pixels_); 1183 1239 fio_nd.Read(is); 1240 FIO_NDataBlock<int> fio_ndi1(&dobj->sliceBeginIndex_); 1241 fio_ndi1.Read(is); 1242 FIO_NDataBlock<int> fio_ndi2(&dobj->sliceLenght_); 1243 fio_ndi2.Read(is); 1184 1244 } 1185 1245 … … 1216 1276 os.PutI4(nPix); 1217 1277 os.PutR8(dobj->PixSolAngle()); 1218 // On ecrit le dataBlock1278 // On ecrit les dataBlocks 1219 1279 FIO_NDataBlock<T> fio_nd(&dobj->pixels_); 1220 1280 fio_nd.Write(os); 1281 FIO_NDataBlock<int> fio_ndi1(&dobj->sliceBeginIndex_); 1282 fio_ndi1.Write(os); 1283 FIO_NDataBlock<int> fio_ndi2(&dobj->sliceLenght_); 1284 fio_ndi2.Write(os); 1221 1285 } 1222 1286 -
trunk/SophyaLib/Samba/spheregorski.h
r708 r724 74 74 virtual ~SphereGorski(); 75 75 76 /*! Setting blockdata to temporary (see ndatablock documentation) */ 77 inline virtual void SetTemp(bool temp=false) const {pixels_.SetTemp(temp);}; 76 78 // ------------------ Definition of PixelMap abstract methods 77 79 … … 87 89 /* Nombre de tranches en theta */ 88 90 /*! Return number of slices in theta direction on the sphere */ 89 int_4 NbThetaSlices() const;91 uint_4 NbThetaSlices() const; 90 92 /*! For a theta-slice with index 'index', return : 91 93 … … 97 99 */ 98 100 void GetThetaSlice(int_4 index,double& theta,TVector<double>& phi,TVector<T>& value) const; 101 /*! For a theta-slice with index 'index', return : 102 103 the corresponding "theta" 104 105 the corresponding "phi" for first pixel of the slice 106 107 a vector containing indices of the pixels of the slice 108 109 (equally distributed in phi) 110 111 a vector containing the corresponding values of pixels 112 */ 113 void GetThetaSlice(int_4 sliceIndex,double& theta, double& phi0, TVector<int>& pixelIndices,TVector<T>& value) const ; 99 114 100 115 /* Return true if teta,phi in map */ … … 184 199 // ------------- méthodes internes ---------------------- 185 200 void InitNul(); 201 void SetThetaSlices(); 186 202 187 203 int_4 nest2ring(int_4 nside,int_4 ipnest) const; … … 200 216 201 217 // ------------- variables internes ----------------------- 218 202 219 int_4 nSide_; 203 220 int_4 nPix_; … … 205 222 206 223 NDataBlock<T> pixels_; 224 NDataBlock<int> sliceBeginIndex_; 225 NDataBlock<int> sliceLenght_; 207 226 208 227 };
Note:
See TracChangeset
for help on using the changeset viewer.