Changeset 1551 in Sophya
- Timestamp:
- Jun 27, 2001, 10:14:39 AM (24 years ago)
- Location:
- trunk/SophyaLib/SkyMap
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SkyMap/localmap.cc
r1431 r1551 640 640 if (nSzX_ != a.nSzX_ || nSzY_ != a.nSzY_) 641 641 { 642 throw(SzMismatchError("LocalMap<T>:: AddElt(const LocalMap<T>&) SizeMismatch")) ;642 throw(SzMismatchError("LocalMap<T>::SubElt(const LocalMap<T>&) SizeMismatch")) ; 643 643 } 644 644 pixels_ -= a.pixels_; … … 652 652 if (nSzX_ != a.nSzX_ || nSzY_ != a.nSzY_) 653 653 { 654 throw(SzMismatchError("LocalMap<T>:: AddElt(const LocalMap<T>&) SizeMismatch")) ;654 throw(SzMismatchError("LocalMap<T>::MulElt(const LocalMap<T>&) SizeMismatch")) ; 655 655 } 656 656 pixels_ *= a.pixels_; 657 return (*this); 658 } 659 660 //! Divide two LocalMaps (elements by elements) - No protection for divide by 0 661 template <class T> 662 LocalMap<T>& LocalMap<T>::DivElt(const LocalMap<T>& a) 663 { 664 if (nSzX_ != a.nSzX_ || nSzY_ != a.nSzY_) 665 { 666 throw(SzMismatchError("LocalMap<T>::DivElt(const LocalMap<T>&) SizeMismatch")) ; 667 } 668 pixels_ /= a.pixels_; 657 669 return (*this); 658 670 } -
trunk/SophyaLib/SkyMap/localmap.h
r1429 r1551 142 142 virtual LocalMap<T>& MulElt(const LocalMap<T>& a); 143 143 inline LocalMap<T>& operator *= (const LocalMap<T>& a) { return MulElt(a); } 144 virtual LocalMap<T>& DivElt(const LocalMap<T>& a); 145 inline LocalMap<T>& operator /= (const LocalMap<T>& a) { return DivElt(a); } 144 146 145 147 … … 255 257 return result; } 256 258 259 //////////////////////////////////////////////////////////////// 260 // Surcharge d'operateurs C = A (*,/) B 261 262 /*! \ingroup SkyMap \fn operator*(const LocalMap<T>&,const LocalMap<T>&) 263 \brief Operator LocalMap = LocalMap * LocalMap (pixel by pixel multiply)*/ 264 template <class T> 265 inline LocalMap<T> operator * (const LocalMap<T>& a,const LocalMap<T>& b) 266 { LocalMap<T> result; result.SetTemp(true); 267 if (b.IsTemp()) { result.Share(b); result.MulElt(a); } 268 else { result.CloneOrShare(a); result.MulElt(b); } 269 return result; } 270 271 /*! \ingroup SkyMap \fn operator/(const LocalMap<T>&,const LocalMap<T>&) 272 \brief Operator LocalMap = LocalMap / LocalMap (pixel by pixel divide)*/ 273 template <class T> 274 inline LocalMap<T> operator / (const LocalMap<T>& a,const LocalMap<T>& b) 275 { LocalMap<T> result; result.SetTemp(true); 276 if (b.IsTemp()) { result.Share(b); result.DivElt(a); } 277 else { result.CloneOrShare(a); result.DivElt(b); } 278 return result; } 279 280 257 281 258 282 } // Fin du namespace -
trunk/SophyaLib/SkyMap/spherehealpix.cc
r1419 r1551 645 645 if (NbPixels() != a.NbPixels() ) 646 646 { 647 throw(SzMismatchError("SphereHEALPix<T>:: SubElt(const SphereHEALPix<T>&) SizeMismatch")) ;647 throw(SzMismatchError("SphereHEALPix<T>::MulElt(const SphereHEALPix<T>&) SizeMismatch")) ; 648 648 } 649 649 pixels_ *= a.pixels_; 650 return (*this); 651 } 652 653 //! Divide two SphereHEALPix (elements by elements) - No protection for divide by 0 654 template <class T> 655 SphereHEALPix<T>& SphereHEALPix<T>::DivElt(const SphereHEALPix<T>& a) 656 { 657 if (NbPixels() != a.NbPixels() ) 658 { 659 throw(SzMismatchError("SphereHEALPix<T>::DivElt(const SphereHEALPix<T>&) SizeMismatch")) ; 660 } 661 pixels_ /= a.pixels_; 650 662 return (*this); 651 663 } -
trunk/SophyaLib/SkyMap/spherehealpix.h
r1429 r1551 171 171 virtual SphereHEALPix<T>& MulElt(const SphereHEALPix<T>& a); 172 172 inline SphereHEALPix<T>& operator *= (const SphereHEALPix<T>& a) { return MulElt(a); } 173 virtual SphereHEALPix<T>& DivElt(const SphereHEALPix<T>& a); 174 inline SphereHEALPix<T>& operator /= (const SphereHEALPix<T>& a) { return DivElt(a); } 173 175 174 176 … … 278 280 return result; } 279 281 282 //////////////////////////////////////////////////////////////// 283 // Surcharge d'operateurs C = A (*,/) B 284 285 /*! \ingroup SkyMap \fn operator*(const SphereHEALPix<T>&,const SphereHEALPix<T>&) 286 \brief Operator SphereHEALPix = SphereHEALPix * SphereHEALPix (pixel by pixel multiply) */ 287 template <class T> 288 inline SphereHEALPix<T> operator * (const SphereHEALPix<T>& a,const SphereHEALPix<T>& b) 289 { SphereHEALPix<T> result; result.SetTemp(true); 290 if (b.IsTemp()) { result.Share(b); result.MulElt(a); } 291 else { result.CloneOrShare(a); result.MulElt(b); } 292 return result; } 293 294 /*! \ingroup SkyMap \fn operator/(const SphereHEALPix<T>&,const SphereHEALPix<T>&) 295 \brief Operator SphereHEALPix = SphereHEALPix / SphereHEALPix (pixel by pixel divide) */ 296 template <class T> 297 inline SphereHEALPix<T> operator / (const SphereHEALPix<T>& a,const SphereHEALPix<T>& b) 298 { SphereHEALPix<T> result; result.SetTemp(true); 299 if (b.IsTemp()) { result.Share(b); result.DivElt(a); } 300 else { result.CloneOrShare(a); result.DivElt(b); } 301 return result; } 302 280 303 } // Fin du namespace 281 304 -
trunk/SophyaLib/SkyMap/spherethetaphi.cc
r1419 r1551 811 811 if (NbPixels()!= a.NbPixels()) 812 812 { 813 throw(SzMismatchError("SphereThetaPhi<T>:: SubElt(const SphereThetaPhi<T>&) SizeMismatch")) ;813 throw(SzMismatchError("SphereThetaPhi<T>::MulElt(const SphereThetaPhi<T>&) SizeMismatch")) ; 814 814 } 815 815 pixels_ *= a.pixels_; 816 return (*this); 817 } 818 819 //! Divide two SphereThetaPhi (elements by elements) - No protection for divide by 0 820 template <class T> 821 SphereThetaPhi<T>& SphereThetaPhi<T>::DivElt(const SphereThetaPhi<T>& a) 822 { 823 if (NbPixels()!= a.NbPixels()) 824 { 825 throw(SzMismatchError("SphereThetaPhi<T>::DivElt(const SphereThetaPhi<T>&) SizeMismatch")) ; 826 } 827 pixels_ /= a.pixels_; 816 828 return (*this); 817 829 } -
trunk/SophyaLib/SkyMap/spherethetaphi.h
r1423 r1551 223 223 virtual SphereThetaPhi<T>& MulElt(const SphereThetaPhi<T>& a); 224 224 inline SphereThetaPhi<T>& operator *= (const SphereThetaPhi<T>& a) { return MulElt(a); } 225 virtual SphereThetaPhi<T>& DivElt(const SphereThetaPhi<T>& a); 226 inline SphereThetaPhi<T>& operator /= (const SphereThetaPhi<T>& a) { return DivElt(a); } 225 227 226 228 … … 332 334 return result; } 333 335 336 //////////////////////////////////////////////////////////////// 337 // Surcharge d'operateurs C = A (*,/) B 338 339 /*! \ingroup SkyMap \fn operator*(const SphereThetaPhi<T>&,const SphereThetaPhi<T>&) 340 \brief Operator SphereThetaPhi = SphereThetaPhi * SphereThetaPhi (pixel by pixel multiply)*/ 341 template <class T> 342 inline SphereThetaPhi<T> operator * (const SphereThetaPhi<T>& a,const SphereThetaPhi<T>& b) 343 { SphereThetaPhi<T> result; result.SetTemp(true); 344 if (b.IsTemp()) { result.Share(b); result.MulElt(a); } 345 else { result.CloneOrShare(a); result.MulElt(b); } 346 return result; } 347 348 /*! \ingroup SkyMap \fn operator/(const SphereThetaPhi<T>&,const SphereThetaPhi<T>&) 349 \brief Operator SphereThetaPhi = SphereThetaPhi / SphereThetaPhi (pixel by pixel divide) */ 350 template <class T> 351 inline SphereThetaPhi<T> operator / (const SphereThetaPhi<T>& a,const SphereThetaPhi<T>& b) 352 { SphereThetaPhi<T> result; result.SetTemp(true); 353 if (b.IsTemp()) { result.Share(b); result.DivElt(a, true); } 354 else { result.CloneOrShare(a); result.DivElt(b); } 355 return result; } 356 334 357 335 358 } // Fin du namespace
Note:
See TracChangeset
for help on using the changeset viewer.