Ignore:
Timestamp:
Feb 23, 2001, 12:26:48 PM (25 years ago)
Author:
lemeur
Message:

surcharge d'operateurs =, +=, *= etc...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/SkyMap/spherethetaphi.cc

    r980 r1419  
    5555//    m is the number of slices in theta on an hemisphere (the polar cap
    5656//    forms the first slice).
    57 //    pet is a dummy parameter at the moment.
    5857//--
    5958{
     
    129128  Theta_.CloneOrShare(a.Theta_);
    130129  pixels_.CloneOrShare(a.pixels_);
     130  if (mInfo_) {delete mInfo_; mInfo_ = NULL;}
     131  if (a.mInfo_) mInfo_ = new DVList(*(a.mInfo_));
     132}
     133template<class T>
     134void  SphereThetaPhi<T>::Share(const  SphereThetaPhi<T>& a)
     135{
     136
     137  NTheta_= a.NTheta_;
     138  NPix_  = a.NPix_;
     139  Omega_ = a.Omega_;
     140  NPhi_.Share(a.NPhi_);
     141  TNphi_.Share(a.TNphi_);
     142  Theta_.Share(a.Theta_);
     143  pixels_.Share(a.pixels_);
     144  if (mInfo_) {delete mInfo_; mInfo_ = NULL;}
     145  if (a.mInfo_) mInfo_ = new DVList(*(a.mInfo_));
    131146}
    132147
     
    710725  os << endl;
    711726}
     727
     728//   ...... Operations de calcul  ......
     729
     730
     731//! Fill a SphereThetaPhi with a constant value \b a
     732template <class T>
     733SphereThetaPhi<T>& SphereThetaPhi<T>::SetT(T a)
     734{
     735  if (NbPixels() < 1)
     736    throw RangeCheckError("SphereThetaPhi<T>::SetT(T )  - SphereThetaPhi not dimensionned ! ");
     737  pixels_ = a;
     738  return (*this);
     739}
     740
     741/*! Add a constant value \b x to a SphereThetaPhi */
     742template <class T>
     743SphereThetaPhi<T>& SphereThetaPhi<T>::Add(T a)
     744 {
     745  if (NbPixels()< 1)
     746    throw RangeCheckError("SphereThetaPhi<T>::Add(T )  - SphereThetaPhi not dimensionned ! ");
     747  pixels_ += a;
     748  return (*this);
     749}
     750
     751/*! Substract a constant value \b a to a SphereThetaPhi */
     752template <class T>
     753SphereThetaPhi<T>& SphereThetaPhi<T>::Sub(T a)
     754{
     755  if (NbPixels()< 1)
     756    throw RangeCheckError("SphereThetaPhi<T>::Sub(T )  - SphereThetaPhi not dimensionned ! ");
     757  pixels_ -= a;
     758  return (*this);
     759}
     760
     761/*! multiply a SphereThetaPhi by a constant value \b a */
     762template <class T>
     763SphereThetaPhi<T>& SphereThetaPhi<T>::Mul(T a)
     764{
     765  if (NbPixels()< 1)
     766    throw RangeCheckError("SphereThetaPhi<T>::Mul(T )  - SphereThetaPhi not dimensionned ! ");
     767  pixels_ *= a;
     768  return (*this);
     769}
     770
     771/*! divide a SphereThetaPhi by a constant value \b a */
     772template <class T>
     773SphereThetaPhi<T>& SphereThetaPhi<T>::Div(T a)
     774{
     775  if (NbPixels()< 1)
     776    throw RangeCheckError("SphereThetaPhi<T>::Div(T )  - SphereThetaPhi not dimensionned ! ");
     777  pixels_ /= a;
     778  return (*this);
     779}
     780
     781//  >>>> Operations avec 2nd membre de type SphereThetaPhi
     782//! Add two SphereThetaPhi
     783
     784template <class T>
     785SphereThetaPhi<T>& SphereThetaPhi<T>::AddElt(const SphereThetaPhi<T>& a)
     786{
     787  if (NbPixels()!= a.NbPixels())
     788    {
     789    throw(SzMismatchError("SphereThetaPhi<T>::AddElt(const SphereThetaPhi<T>&) SizeMismatch")) ;
     790    }
     791  pixels_ += a.pixels_;
     792  return (*this);
     793}
     794
     795//! Substract two SphereThetaPhi
     796template <class T>
     797SphereThetaPhi<T>& SphereThetaPhi<T>::SubElt(const SphereThetaPhi<T>& a)
     798{
     799  if (NbPixels()!= a.NbPixels())
     800    {
     801    throw(SzMismatchError("SphereThetaPhi<T>::SubElt(const SphereThetaPhi<T>&) SizeMismatch")) ;
     802    }
     803  pixels_ -= a.pixels_;
     804  return (*this);
     805}
     806
     807//! Multiply two SphereThetaPhi (elements by elements)
     808template <class T>
     809SphereThetaPhi<T>& SphereThetaPhi<T>::MulElt(const SphereThetaPhi<T>& a)
     810{
     811  if (NbPixels()!= a.NbPixels())
     812    {
     813    throw(SzMismatchError("SphereThetaPhi<T>::SubElt(const SphereThetaPhi<T>&) SizeMismatch")) ;
     814    }
     815  pixels_ *= a.pixels_;
     816  return (*this);
     817}
     818
    712819
    713820
Note: See TracChangeset for help on using the changeset viewer.