Changeset 980 in Sophya
- Timestamp:
- Apr 28, 2000, 4:12:44 PM (25 years ago)
- Location:
- trunk/SophyaLib/SkyMap
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SkyMap/spherehealpix.cc
r979 r980 261 261 template<class T> 262 262 SphereHEALPix<T>& SphereHEALPix<T>::Set(const SphereHEALPix<T>& a) 263 263 { 264 264 if (this != &a) 265 265 { 266 267 if (a.NbPixels() < 1) 268 throw RangeCheckError("SphereHEALPix<T>::Set(a ) - Array a not allocated ! "); 269 if (NbPixels() < 1) CloneOrShare(a); 270 else CopyElt(a); 271 272 273 // CloneOrShare(a); 274 if (mInfo_) delete mInfo_; 275 mInfo_ = NULL; 276 if (a.mInfo_) mInfo_ = new DVList(*(a.mInfo_)); 266 267 if (a.NbPixels() < 1) 268 throw RangeCheckError("SphereHEALPix<T>::Set(a ) - Array a not allocated ! "); 269 if (NbPixels() < 1) CloneOrShare(a); 270 else CopyElt(a); 271 272 273 if (mInfo_) delete mInfo_; 274 mInfo_ = NULL; 275 if (a.mInfo_) mInfo_ = new DVList(*(a.mInfo_)); 277 276 } 278 277 return(*this); 279 278 } 280 279 281 280 template<class T> … … 285 284 throw RangeCheckError("SphereHEALPix<T>::CopyElt(const SphereHEALPix<T>& ) - Not Allocated Array ! "); 286 285 if (NbPixels() != a.NbPixels()) 287 throw(SzMismatchError(" TArray<T>::MultElt(const TArray<T>&) SizeMismatch")) ;286 throw(SzMismatchError("SphereHEALPix<T>::CopyElt(const SphereHEALPix<T>&) SizeMismatch")) ; 288 287 nSide_= a.nSide_; 289 288 nPix_ = a.nPix_; -
trunk/SophyaLib/SkyMap/spherehealpix.h
r908 r980 215 215 216 216 inline SphereHEALPix<T>& operator = (const SphereHEALPix<T>& a) 217 {return Set(a);}217 {return Set(a);} 218 218 219 219 private : … … 239 239 void CloneOrShare(const SphereHEALPix<T>& a); 240 240 SphereHEALPix<T>& Set(const SphereHEALPix<T>& a); 241 SphereHEALPix<T>& CopyElt(const SphereHEALPix<T>& a); 241 242 242 243 // ------------- variables internes ----------------------- -
trunk/SophyaLib/SkyMap/spherethetaphi.cc
r908 r980 39 39 template <class T> 40 40 SphereThetaPhi<T>::SphereThetaPhi() 41 : NPhi_(), TNphi_(), Theta_(), pixels_() 41 42 42 43 //-- 43 44 { 44 45 InitNul(); 45 pixels_.Reset();46 46 } 47 47 … … 67 67 pixels_(s.pixels_ , share) 68 68 { 69 if(s.mInfo_) mInfo_= new DVList(*s.mInfo_);70 69 71 70 NTheta_= s.NTheta_; 72 71 NPix_ = s.NPix_; 73 72 Omega_ = s.Omega_; 73 if(s.mInfo_) mInfo_= new DVList(*s.mInfo_); 74 74 } 75 75 … … 78 78 : NPhi_(s.NPhi_), TNphi_(s.TNphi_), Theta_(s.Theta_), pixels_(s.pixels_) 79 79 { 80 if(s.mInfo_) mInfo_= new DVList(*s.mInfo_);81 80 82 81 NTheta_= s.NTheta_; 83 82 NPix_ = s.NPix_; 84 83 Omega_ = s.Omega_; 84 if(s.mInfo_) mInfo_= new DVList(*s.mInfo_); 85 85 } 86 86 … … 122 122 { 123 123 124 NPhi_.CloneOrShare(a.NPhi_); 125 TNphi_.CloneOrShare(a.TNphi_); 126 Theta_.CloneOrShare(a.Theta_); 127 pixels_.CloneOrShare(a.pixels_); 128 } 129 124 NTheta_= a.NTheta_; 125 NPix_ = a.NPix_; 126 Omega_ = a.Omega_; 127 NPhi_.CloneOrShare(a.NPhi_); 128 TNphi_.CloneOrShare(a.TNphi_); 129 Theta_.CloneOrShare(a.Theta_); 130 pixels_.CloneOrShare(a.pixels_); 131 } 132 133 ////////////////////////// methodes de copie/share 130 134 template<class T> 131 135 SphereThetaPhi<T>& SphereThetaPhi<T>::Set(const SphereThetaPhi<T>& a) 132 136 { 133 137 if (this != &a) 134 138 { 135 136 137 NTheta_= a.NTheta_;138 NPix_ = a.NPix_;139 Omega_ = a.Omega_;140 CloneOrShare(a);139 140 141 if (a.NbPixels() < 1) 142 throw RangeCheckError("SphereThetaPhi<T>::Set(a ) - Array a not allocated ! "); 143 if (NbPixels() < 1) CloneOrShare(a); 144 else CopyElt(a); 141 145 if (mInfo_) delete mInfo_; 142 146 mInfo_ = NULL; … … 144 148 } 145 149 return(*this); 146 } 147 148 150 } 151 152 template<class T> 153 SphereThetaPhi<T>& SphereThetaPhi<T>::CopyElt(const SphereThetaPhi<T>& a) 154 { 155 if (NbPixels() < 1) 156 throw RangeCheckError("SphereThetaPhi<T>::CopyElt(const SphereThetaPhi<T>& ) - Not Allocated Array ! "); 157 if (NbPixels() != a.NbPixels()) 158 throw(SzMismatchError("SphereThetaPhi<T>::CopyElt(const SphereThetaPhi<T>&) SizeMismatch")) ; 159 160 NTheta_= a.NTheta_; 161 NPix_ = a.NPix_; 162 Omega_ = a.Omega_; 163 int k; 164 for (k=0; k< NPix_; k++) pixels_(k) = a.pixels_(k); 165 for (k=0; k< a.NPhi_.Size(); k++) NPhi_(k) = a.NPhi_(k); 166 for (k=0; k< a.TNphi_.Size(); k++) TNphi_(k) = a.TNphi_(k); 167 for (k=0; k< a.Theta_.Size(); k++) Theta_(k) = a.Theta_(k); 168 return(*this); 169 170 } 149 171 150 172 /* --Methode-- */ … … 524 546 // Le nombre de pixels en phi de chacune des bandes en theta 525 547 // NPhi_ = new int_4[m]; 526 NPhi_.ReSize(m); 548 // une taille de m suffit, mais je mets m+1 pour que les 3 tableaux aient 549 // la meme taille pour une manipulation plus faciles par la librairie 550 // cfitsio -- GLM (13-04-00) 551 NPhi_.ReSize(m+1); 527 552 528 553 // Le nombre/Deuxpi total des pixels contenus dans les bandes de z superieur a une -
trunk/SophyaLib/SkyMap/spherethetaphi.h
r908 r980 15 15 template <class T> 16 16 class FIO_SphereThetaPhi; 17 18 template<class T> 19 class FITS_SphereThetaPhi; 17 20 18 21 … … 33 36 34 37 friend class FIO_SphereThetaPhi<T>; 38 friend class FITS_SphereThetaPhi<T>; 35 39 36 40 public : … … 198 202 199 203 SphereThetaPhi<T>& Set(const SphereThetaPhi<T>& a); 204 SphereThetaPhi<T>& CopyElt(const SphereThetaPhi<T>& a); 200 205 201 206 // ------------- variables internes ---------------------
Note:
See TracChangeset
for help on using the changeset viewer.