Changeset 1419 in Sophya for trunk/SophyaLib/SkyMap/spherehealpix.cc
- Timestamp:
- Feb 23, 2001, 12:26:48 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SkyMap/spherehealpix.cc
r1304 r1419 127 127 } 128 128 129 //! Clone if \b a is not temporary, share if temporary 130 /*! \sa NDataBlock::CloneOrShare(const NDataBlock<T>&) */ 129 131 template<class T> 130 132 void SphereHEALPix<T>::CloneOrShare(const SphereHEALPix<T>& a) … … 136 138 sliceBeginIndex_.CloneOrShare(a.sliceBeginIndex_); 137 139 sliceLenght_.CloneOrShare(a.sliceLenght_); 138 139 // pas forcement a conserver, pas forcement a cet endroit (GLM) 140 // if (a.IsTemp() ) SetTemp(true); 140 if (mInfo_) {delete mInfo_; mInfo_ = NULL;} 141 if (a.mInfo_) mInfo_ = new DVList(*(a.mInfo_)); 142 } 143 144 //! Share data with a 145 template<class T> 146 void SphereHEALPix<T>::Share(const SphereHEALPix<T>& a) 147 { 148 nSide_= a.nSide_; 149 nPix_ = a.nPix_; 150 omeg_ = a.omeg_; 151 pixels_.Share(a.pixels_); 152 sliceBeginIndex_.Share(a.sliceBeginIndex_); 153 sliceLenght_.Share(a.sliceLenght_); 154 if (mInfo_) {delete mInfo_; mInfo_ = NULL;} 155 if (a.mInfo_) mInfo_ = new DVList(*(a.mInfo_)); 141 156 } 142 157 … … 149 164 150 165 if (a.NbPixels() < 1) 151 throw RangeCheckError("SphereHEALPix<T>::Set(a ) - Arraya not allocated ! ");166 throw RangeCheckError("SphereHEALPix<T>::Set(a ) - SphereHEALPix a not allocated ! "); 152 167 if (NbPixels() < 1) CloneOrShare(a); 153 168 else CopyElt(a); … … 165 180 { 166 181 if (NbPixels() < 1) 167 throw RangeCheckError("SphereHEALPix<T>::CopyElt(const SphereHEALPix<T>& ) - Not Allocated Array! ");182 throw RangeCheckError("SphereHEALPix<T>::CopyElt(const SphereHEALPix<T>& ) - Not Allocated SphereHEALPix ! "); 168 183 if (NbPixels() != a.NbPixels()) 169 184 throw(SzMismatchError("SphereHEALPix<T>::CopyElt(const SphereHEALPix<T>&) SizeMismatch")) ; … … 177 192 return(*this); 178 193 } 194 195 196 179 197 //++ 180 198 // Titre Destructor … … 542 560 return ring2nest(nSide_,k); 543 561 } 562 563 // ...... Operations de calcul ...... 564 565 //! Fill a SphereHEALPix with a constant value \b a 566 template <class T> 567 SphereHEALPix<T>& SphereHEALPix<T>::SetT(T a) 568 { 569 if (NbPixels() < 1) 570 throw RangeCheckError("SphereHEALPix<T>::SetT(T ) - SphereHEALPix not dimensionned ! "); 571 pixels_ = a; 572 return (*this); 573 } 574 575 /*! Add a constant value \b x to a SphereHEALPix */ 576 template <class T> 577 SphereHEALPix<T>& SphereHEALPix<T>::Add(T a) 578 { 579 if (NbPixels() < 1) 580 throw RangeCheckError("SphereHEALPix<T>::Add(T ) - SphereHEALPix not dimensionned ! "); 581 pixels_ += a; 582 return (*this); 583 } 584 585 /*! Substract a constant value \b a to a SphereHEALPix */ 586 template <class T> 587 SphereHEALPix<T>& SphereHEALPix<T>::Sub(T a) 588 { 589 if (NbPixels() < 1) 590 throw RangeCheckError("SphereHEALPix<T>::Sub(T ) - SphereHEALPix not dimensionned ! "); 591 pixels_ -= a; 592 return (*this); 593 } 594 595 /*! multiply a SphereHEALPix by a constant value \b a */ 596 template <class T> 597 SphereHEALPix<T>& SphereHEALPix<T>::Mul(T a) 598 { 599 if (NbPixels() < 1) 600 throw RangeCheckError("SphereHEALPix<T>::Mul(T ) - SphereHEALPix not dimensionned ! "); 601 pixels_ *= a; 602 return (*this); 603 } 604 605 /*! divide a SphereHEALPix by a constant value \b a */ 606 template <class T> 607 SphereHEALPix<T>& SphereHEALPix<T>::Div(T a) 608 { 609 if (NbPixels() < 1) 610 throw RangeCheckError("SphereHEALPix<T>::Div(T ) - SphereHEALPix not dimensionned ! "); 611 pixels_ /= a; 612 return (*this); 613 } 614 615 // >>>> Operations avec 2nd membre de type SphereHEALPix 616 //! Add two SphereHEALPix 617 618 template <class T> 619 SphereHEALPix<T>& SphereHEALPix<T>::AddElt(const SphereHEALPix<T>& a) 620 { 621 if (NbPixels() != a.NbPixels() ) 622 { 623 throw(SzMismatchError("SphereHEALPix<T>::AddElt(const SphereHEALPix<T>&) SizeMismatch")) ; 624 } 625 pixels_ += a.pixels_; 626 return (*this); 627 } 628 629 //! Substract two SphereHEALPix 630 template <class T> 631 SphereHEALPix<T>& SphereHEALPix<T>::SubElt(const SphereHEALPix<T>& a) 632 { 633 if (NbPixels() != a.NbPixels() ) 634 { 635 throw(SzMismatchError("SphereHEALPix<T>::SubElt(const SphereHEALPix<T>&) SizeMismatch")) ; 636 } 637 pixels_ -= a.pixels_; 638 return (*this); 639 } 640 641 //! Multiply two SphereHEALPix (elements by elements) 642 template <class T> 643 SphereHEALPix<T>& SphereHEALPix<T>::MulElt(const SphereHEALPix<T>& a) 644 { 645 if (NbPixels() != a.NbPixels() ) 646 { 647 throw(SzMismatchError("SphereHEALPix<T>::SubElt(const SphereHEALPix<T>&) SizeMismatch")) ; 648 } 649 pixels_ *= a.pixels_; 650 return (*this); 651 } 652 653 544 654 545 655
Note:
See TracChangeset
for help on using the changeset viewer.