source: Sophya/trunk/SophyaLib/SkyMap/spherehealpix.cc@ 2973

Last change on this file since 2973 was 2973, checked in by ansari, 19 years ago

1/ Nettoyage+commentaires/doxygen ds Vector3d, UnitVector, LongLat,
SphereCoordSys ...
2/ Ajout de la classe angle pour faciliter les conversions rad<>deg<>arcmin
dans le fichier vector3d.h .cc
3/ nettoyage/uniformisation methodes print pour pixelmap, ajout de la
methode PixelMap<T>::Show()
4/ Ajout methodes SphericalMap<T>::HasSymThetaSlice() et
GetSymThetaSliceIndex(int_4 idx) et leurs implementations pour
SphereHEALPix et SphereThetaPhi en vue de l'optimisation du calcul
transforme Ylm
5/ Ajout methode ResolToSizeIndex ds SphereThetaPhi , SphereHEALPix et
SphereECP

Reza , 20 Juin 2006

File size: 18.6 KB
Line 
1#include "sopnamsp.h"
2#include "machdefs.h"
3#include <math.h>
4#include <complex>
5
6#include "pexceptions.h"
7#include "fiondblock.h"
8#include "spherehealpix.h"
9#include "strutil.h"
10
11extern "C"
12{
13#include <stdio.h>
14#include <stdlib.h>
15#include <unistd.h>
16}
17
18using namespace SOPHYA;
19
20/*!
21 \class SOPHYA::SphereHEALPix
22 \ingroup SkyMap
23 \brief Spherical maps in HEALPix pixelisation scheme.
24
25 Class implementing spherical maps, in the HEALPix pixelisation scheme,
26 with template data types (double, float, complex, ...)
27
28
29\verbatim
30 Adapted from :
31 -----------------------------------------------------------------------
32 version 0.8.2 Aug97 TAC Eric Hivon, Kris Gorski
33 -----------------------------------------------------------------------
34
35 the sphere is split in 12 diamond-faces containing nside**2 pixels each
36 the numbering of the pixels (in the nested scheme) is similar to
37 quad-cube
38 In each face the first pixel is in the lowest corner of the diamond
39 the faces are (x,y) coordinate on each face
40
41 . . . . <--- North Pole
42 / \ / \ / \ / \ ^ ^
43 . 0 . 1 . 2 . 3 . <--- z = 2/3 \ /
44 \ / \ / \ / \ / y \ / x
45 4 . 5 . 6 . 7 . 4 <--- equator \ /
46 / \ / \ / \ / \ \/
47 . 8 . 9 .10 .11 . <--- z = -2/3 (0,0) : lowest corner
48 \ / \ / \ / \ /
49 . . . . <--- South Pole
50\endverbatim
51 phi:0 2Pi
52
53 in the ring scheme pixels are numbered along the parallels
54 the first parallel is the one closest to the north pole and so on
55 on each parallel, pixels are numbered starting from the one closest
56 to phi = 0
57
58 nside MUST be a power of 2 (<= 8192)
59
60*/
61
62/* --Methode-- */
63
64template<class T>
65SphereHEALPix<T>::SphereHEALPix() : pixels_(), sliceBeginIndex_(),
66 sliceLenght_()
67
68
69{
70 InitNul();
71}
72
73/*! \fn SOPHYA::SphereHEALPix::SphereHEALPix(int_4 m)
74
75 \param <m> : "nside" of the Healpix algorithm
76
77 The total number of pixels will be Npix = 12*nside**2
78
79 nside MUST be a power of 2 (<= 8192)
80*/
81
82template<class T>
83SphereHEALPix<T>::SphereHEALPix(int_4 m)
84
85{
86 InitNul();
87 Pixelize(m);
88 SetThetaSlices();
89}
90//! Copy constructor
91template<class T>
92SphereHEALPix<T>::SphereHEALPix(const SphereHEALPix<T>& s, bool share)
93 : pixels_(s.pixels_, share), sliceBeginIndex_(s.sliceBeginIndex_, share),
94 sliceLenght_(s.sliceLenght_, share)
95//--
96{
97 nSide_= s.nSide_;
98 nPix_ = s.nPix_;
99 omeg_ = s.omeg_;
100 if(s.mInfo_) this->mInfo_= new DVList(*s.mInfo_);
101}
102//++
103template<class T>
104SphereHEALPix<T>::SphereHEALPix(const SphereHEALPix<T>& s)
105 : pixels_(s.pixels_), sliceBeginIndex_(s.sliceBeginIndex_),
106 sliceLenght_(s.sliceLenght_)
107// copy constructor
108//--
109{
110 nSide_= s.nSide_;
111 nPix_ = s.nPix_;
112 omeg_ = s.omeg_;
113 if(s.mInfo_) this->mInfo_= new DVList(*s.mInfo_);
114 // CloneOrShare(s);
115}
116
117//! Clone if \b a is not temporary, share if temporary
118/*! \sa NDataBlock::CloneOrShare(const NDataBlock<T>&) */
119template<class T>
120void SphereHEALPix<T>::CloneOrShare(const SphereHEALPix<T>& a)
121{
122 nSide_= a.nSide_;
123 nPix_ = a.nPix_;
124 omeg_ = a.omeg_;
125 pixels_.CloneOrShare(a.pixels_);
126 sliceBeginIndex_.CloneOrShare(a.sliceBeginIndex_);
127 sliceLenght_.CloneOrShare(a.sliceLenght_);
128 if (this->mInfo_) {delete this->mInfo_; this->mInfo_ = NULL;}
129 if (a.mInfo_) this->mInfo_ = new DVList(*(a.mInfo_));
130}
131
132//! Share data with a
133template<class T>
134void SphereHEALPix<T>::Share(const SphereHEALPix<T>& a)
135{
136 nSide_= a.nSide_;
137 nPix_ = a.nPix_;
138 omeg_ = a.omeg_;
139 pixels_.Share(a.pixels_);
140 sliceBeginIndex_.Share(a.sliceBeginIndex_);
141 sliceLenght_.Share(a.sliceLenght_);
142 if (this->mInfo_) {delete this->mInfo_; this->mInfo_ = NULL;}
143 if (a.mInfo_) this->mInfo_ = new DVList(*(a.mInfo_));
144}
145
146////////////////////////// methodes de copie/share
147template<class T>
148SphereHEALPix<T>& SphereHEALPix<T>::Set(const SphereHEALPix<T>& a)
149{
150 if (this != &a)
151 {
152
153 if (a.NbPixels() < 1)
154 throw RangeCheckError("SphereHEALPix<T>::Set(a ) - SphereHEALPix a not allocated ! ");
155 if (NbPixels() < 1) CloneOrShare(a);
156 else CopyElt(a);
157
158
159 if (this->mInfo_) delete this->mInfo_;
160 this->mInfo_ = NULL;
161 if (a.mInfo_) this->mInfo_ = new DVList(*(a.mInfo_));
162 }
163 return(*this);
164}
165
166template<class T>
167SphereHEALPix<T>& SphereHEALPix<T>::CopyElt(const SphereHEALPix<T>& a)
168{
169 if (NbPixels() < 1)
170 throw RangeCheckError("SphereHEALPix<T>::CopyElt(const SphereHEALPix<T>& ) - Not Allocated SphereHEALPix ! ");
171 if (NbPixels() != a.NbPixels())
172 throw(SzMismatchError("SphereHEALPix<T>::CopyElt(const SphereHEALPix<T>&) SizeMismatch")) ;
173 nSide_= a.nSide_;
174 nPix_ = a.nPix_;
175 omeg_ = a.omeg_;
176 int k;
177 for (k=0; k< nPix_; k++) pixels_(k) = a.pixels_(k);
178 for (k=0; k< a.sliceBeginIndex_.Size(); k++) sliceBeginIndex_(k) = a.sliceBeginIndex_(k);
179 for (k=0; k< a.sliceLenght_.Size(); k++) sliceLenght_(k) = a.sliceLenght_(k);
180 return(*this);
181}
182
183
184
185//++
186// Titre Destructor
187//--
188//++
189template<class T>
190SphereHEALPix<T>::~SphereHEALPix()
191
192//--
193{
194}
195
196//++
197// Titre Public Methods
198//--
199
200/*! \fn void SOPHYA::SphereHEALPix::Resize(int_4 m)
201 \param <m> "nside" of the HEALPix algorithm
202
203 The total number of pixels will be Npix = 12*nside**2
204
205 nside MUST be a power of 2 (<= 8192)
206*/
207template<class T>
208void SphereHEALPix<T>::Resize(int_4 m)
209
210
211{
212 if ((m <= 0 && nSide_ > 0)) {
213 cout << "SphereHEALPix<T>::Resize(m) with m<=0, NOT resized" << endl;
214 return;
215 }
216 InitNul();
217 Pixelize(m);
218 SetThetaSlices();
219}
220
221template<class T>
222void SphereHEALPix<T>::Pixelize( int_4 m)
223
224// prépare la pixelisation Gorski (m a la même signification
225// que pour le constructeur)
226//
227//
228{
229 if (m<=0 || m> 8192) {
230 cout << "SphereHEALPix<T>::Pixelize() m=" << m <<" out of range [0,8192]" << endl;
231 throw ParmError("SphereHEALPix<T>::Pixelize() m out of range");
232 }
233 // verifier que m est une puissance de deux
234 int x= m;
235 while (x%2==0) x/=2;
236 if(x != 1) {
237 cout << "SphereHEALPix<T>::Pixelize() m=" << m << " != 2^n " << endl;
238 throw ParmError("SphereHEALPix<T>::Pixelize() m!=2^n");
239 }
240
241 // On memorise les arguments d'appel
242 nSide_= m;
243
244 // Nombre total de pixels sur la sphere entiere
245 nPix_= 12*nSide_*nSide_;
246
247 // pour le moment les tableaux qui suivent seront ranges dans l'ordre
248 // de l'indexation GORSKY "RING"
249 // on pourra ulterieurement changer de strategie et tirer profit
250 // de la dualite d'indexation GORSKY (RING et NEST) : tout dependra
251 // de pourquoi c'est faire
252
253 // Creation et initialisation du vecteur des contenus des pixels
254 pixels_.ReSize(nPix_);
255 pixels_.Reset();
256
257 // solid angle per pixel
258 omeg_= 4.0*Pi/nPix_;
259}
260
261template<class T>
262void SphereHEALPix<T>::InitNul()
263//
264// initialise à zéro les variables de classe
265{
266 nSide_= 0;
267 nPix_ = 0;
268 omeg_ = 0.;
269// pixels_.Reset(); - Il ne faut pas mettre les pixels a zero si share !
270}
271
272/* --Methode-- */
273/* Nombre de pixels du decoupage */
274/*! \fn int_4 SOPHYA::SphereHEALPix::NbPixels() const
275
276 Return number of pixels of the splitting
277*/
278template<class T>
279int_4 SphereHEALPix<T>::NbPixels() const
280{
281 return(nPix_);
282}
283
284
285/*! \fn uint_4 SOPHYA::SphereHEALPix::NbThetaSlices() const
286
287 \return number of slices in theta direction on the sphere
288*/
289template<class T>
290uint_4 SphereHEALPix<T>::NbThetaSlices() const
291{
292 uint_4 nbslices = uint_4(4*nSide_-1);
293 if (nSide_<=0)
294 {
295 nbslices = 0;
296 throw PException(" sphere not pixelized, NbSlice=0 ");
297 }
298 return nbslices;
299}
300
301//! Return the theta angle for slice defined by \b index
302template<class T>
303r_8 SphereHEALPix<T>::ThetaOfSlice(int_4 index) const
304{
305 uint_4 nbslices = uint_4(4*nSide_-1);
306 if (index<0 || index >= nbslices)
307 throw RangeCheckError(" SphereHEALPix::ThetaOfSlice() index out of range");
308 r_8 theta, phi0;
309 PixThetaPhi(sliceBeginIndex_(index), theta, phi0);
310 return theta;
311}
312
313//! Return true : All theta slices have a symmetric slice at Pi-Theta in SphereHEALPix
314template <class T>
315bool SphereHEALPix<T>::HasSymThetaSlice() const
316{
317 return true;
318}
319//! Return the slice index for the symmetric slice at theta=Pi-ThetaOfSlice(idx)
320template <class T>
321int_4 SphereHEALPix<T>::GetSymThetaSliceIndex(int_4 idx) const
322{
323 if(idx < 0 || idx >= NbThetaSlices())
324 throw RangeCheckError("SphereHEALPix::GetSymThetaSliceIndex index out of range");
325 return (NbThetaSlices()-1-idx);
326}
327
328/*! \fn void SOPHYA::SphereHEALPix::GetThetaSlice(int_4 index,r_8& theta,TVector<r_8>& phi,TVector<T>& value) const
329
330 For a theta-slice with index 'index', return :
331
332 the corresponding "theta"
333
334 a vector containing the phi's of the pixels of the slice
335
336 a vector containing the corresponding values of pixels
337*/
338template<class T>
339void SphereHEALPix<T>::GetThetaSlice(int_4 index,r_8& theta,TVector<r_8>& phi,TVector<T>& value) const
340
341{
342
343 if (index<0 || index >= NbThetaSlices())
344 {
345 cout << " SphereHEALPix::GetThetaSlice : Pixel index out of range" <<endl;
346 throw RangeCheckError(" SphereHEALPix::GetThetaSlice() index out of range");
347 }
348
349
350 int_4 iring= sliceBeginIndex_(index);
351 int_4 lring = sliceLenght_(index);
352
353 phi.ReSize(lring);
354 value.ReSize(lring);
355
356 double TH= 0.;
357 double FI= 0.;
358 for(int_4 kk = 0; kk < lring;kk++)
359 {
360 PixThetaPhi(kk+iring,TH,FI);
361 phi(kk)= FI;
362 value(kk)= PixVal(kk+iring);
363 }
364 theta= TH;
365}
366/*! \fn void SOPHYA::SphereHEALPix::GetThetaSlice(int_4 sliceIndex,r_8& theta, r_8& phi0, TVector<int_4>& pixelIndices,TVector<T>& value) const
367
368 For a theta-slice with index 'index', return :
369
370 the corresponding "theta"
371
372 the corresponding "phi" for first pixel of the slice
373
374 a vector containing indices of the pixels of the slice
375
376 (equally distributed in phi)
377
378 a vector containing the corresponding values of pixels
379*/
380
381template<class T>
382void SphereHEALPix<T>::GetThetaSlice(int_4 sliceIndex,r_8& theta, r_8& phi0, TVector<int_4>& pixelIndices,TVector<T>& value) const
383
384{
385
386 if (sliceIndex<0 || sliceIndex >= NbThetaSlices())
387 {
388 cout << " SphereHEALPix::GetThetaSlice : Pixel index out of range" <<endl;
389 throw RangeCheckError(" SphereHEALPix::GetThetaSlice : Pixel index out of range");
390 }
391 int_4 iring= sliceBeginIndex_(sliceIndex);
392 int_4 lring = sliceLenght_(sliceIndex);
393 pixelIndices.ReSize(lring);
394 value.ReSize(lring);
395
396 for(int_4 kk = 0; kk < lring;kk++)
397 {
398 pixelIndices(kk)= kk+iring;
399 value(kk)= PixVal(kk+iring);
400 }
401 PixThetaPhi(iring, theta, phi0);
402}
403
404template<class T>
405void SphereHEALPix<T>::SetThetaSlices()
406{
407 sliceBeginIndex_.ReSize(4*nSide_-1);
408 sliceLenght_.ReSize(4*nSide_-1);
409 int sliceIndex;
410 for (sliceIndex=0; sliceIndex< nSide_-1; sliceIndex++)
411 {
412 sliceBeginIndex_(sliceIndex) = 2*sliceIndex*(sliceIndex+1);
413 sliceLenght_(sliceIndex) = 4*(sliceIndex+1);
414 }
415 for (sliceIndex= nSide_-1; sliceIndex< 3*nSide_; sliceIndex++)
416 {
417 sliceBeginIndex_(sliceIndex) = 2*nSide_*(2*sliceIndex-nSide_+1);
418 sliceLenght_(sliceIndex) = 4*nSide_;
419 }
420 for (sliceIndex= 3*nSide_; sliceIndex< 4*nSide_-1; sliceIndex++)
421 {
422 int_4 nc= 4*nSide_-1-sliceIndex;
423 sliceBeginIndex_(sliceIndex) = nPix_-2*nc*(nc+1);
424 sliceLenght_(sliceIndex) = 4*nc;
425 }
426}
427
428
429/*! \fn T& SOPHYA::SphereHEALPix::PixVal(int_4 k)
430
431 \return value of pixel with "RING" index k
432*/
433template<class T>
434T& SphereHEALPix<T>::PixVal(int_4 k)
435
436{
437 if((k < 0) || (k >= nPix_))
438 {
439 throw RangeCheckError("SphereHEALPix::PIxVal Pixel index out of range");
440 }
441 return pixels_(k);
442}
443
444/*! \fn T const& SOPHYA::SphereHEALPix::PixVal(int_4 k) const
445
446 \return value of pixel with "RING" index k
447*/
448template<class T>
449T const& SphereHEALPix<T>::PixVal(int_4 k) const
450
451{
452 if((k < 0) || (k >= nPix_))
453 {
454 throw RangeCheckError("SphereHEALPix::PIxVal Pixel index out of range");
455 }
456 return *(pixels_.Data()+k);
457}
458
459/*! \fn T& SOPHYA::SphereHEALPix::PixValNest(int_4 k)
460
461 \return value of pixel with "NESTED" index k
462*/
463template<class T>
464T& SphereHEALPix<T>::PixValNest(int_4 k)
465
466//--
467{
468 if((k < 0) || (k >= nPix_))
469 {
470 throw RangeCheckError("SphereHEALPix::PIxValNest Pixel index out of range");
471 }
472 return pixels_(nest2ring(nSide_,k));
473}
474
475/*! \fn T const& SOPHYA::SphereHEALPix::PixValNest(int_4 k) const
476
477 \return value of pixel with "NESTED" index k
478*/
479
480template<class T>
481T const& SphereHEALPix<T>::PixValNest(int_4 k) const
482
483{
484 if((k < 0) || (k >= nPix_))
485 {
486 throw RangeCheckError("SphereHEALPix::PIxValNest Pixel index out of range");
487 }
488 int_4 pix= nest2ring(nSide_,k);
489 return *(pixels_.Data()+pix);
490}
491
492/*! \fn bool SOPHYA::SphereHEALPix::ContainsSph(double theta, double phi) const
493
494\return true if teta,phi in map
495*/
496template<class T>
497bool SphereHEALPix<T>::ContainsSph(double theta, double phi) const
498{
499return(true);
500}
501
502/*! \fn int_4 SOPHYA::SphereHEALPix::PixIndexSph(double theta,double phi) const
503
504 \return "RING" index of the pixel corresponding to direction (theta, phi).
505 */
506template<class T>
507int_4 SphereHEALPix<T>::PixIndexSph(double theta,double phi) const
508
509{
510 return ang2pix_ring(nSide_,theta,phi);
511}
512
513/*! \fn int_4 SOPHYA::SphereHEALPix::PixIndexSphNest(double theta,double phi) const
514
515 \return "NESTED" index of the pixel corresponding to direction (theta, phi).
516 */
517template<class T>
518int_4 SphereHEALPix<T>::PixIndexSphNest(double theta,double phi) const
519
520{
521 return ang2pix_nest(nSide_,theta,phi);
522}
523
524
525/* --Methode-- */
526/*! \fn void SOPHYA::SphereHEALPix::PixThetaPhi(int_4 k,double& theta,double& phi) const
527 \return (theta,phi) coordinates of middle of pixel with "RING" index k
528 */
529template<class T>
530void SphereHEALPix<T>::PixThetaPhi(int_4 k,double& theta,double& phi) const
531{
532 pix2ang_ring(nSide_,k,theta,phi);
533}
534
535/*! \fn T SOPHYA::SphereHEALPix::SetPixels(T v)
536
537Set all pixels to value v
538*/
539template <class T>
540T SphereHEALPix<T>::SetPixels(T v)
541{
542pixels_.Reset(v);
543return(v);
544}
545
546
547
548/*! \fn void SOPHYA::SphereHEALPix::PixThetaPhiNest(int_4 k,double& theta,double& phi) const
549
550 \return (theta,phi) coordinates of middle of pixel with "NESTED" index k
551 */
552template<class T>
553void SphereHEALPix<T>::PixThetaPhiNest(int_4 k,double& theta,double& phi) const
554
555{
556 pix2ang_nest(nSide_,k,theta,phi);
557}
558
559
560/*! \fn int_4 SOPHYA::SphereHEALPix::NestToRing(int_4 k) const
561
562 translation from NESTED index into RING index
563*/
564template<class T>
565int_4 SphereHEALPix<T>::NestToRing(int_4 k) const
566
567{
568 return nest2ring(nSide_,k);
569}
570
571
572/*! \fn int_4 SOPHYA::SphereHEALPix::RingToNest(int_4 k) const
573
574 translation from RING index into NESTED index
575*/
576template<class T>
577int_4 SphereHEALPix<T>::RingToNest(int_4 k) const
578{
579 return ring2nest(nSide_,k);
580}
581
582// ...... Operations de calcul ......
583
584//! Fill a SphereHEALPix with a constant value \b a
585template <class T>
586SphereHEALPix<T>& SphereHEALPix<T>::SetT(T a)
587{
588 if (NbPixels() < 1)
589 throw RangeCheckError("SphereHEALPix<T>::SetT(T ) - SphereHEALPix not dimensionned ! ");
590 pixels_ = a;
591 return (*this);
592}
593
594/*! Add a constant value \b x to a SphereHEALPix */
595template <class T>
596SphereHEALPix<T>& SphereHEALPix<T>::Add(T a)
597 {
598 cout << " c'est mon Add " << endl;
599 if (NbPixels() < 1)
600 throw RangeCheckError("SphereHEALPix<T>::Add(T ) - SphereHEALPix not dimensionned ! ");
601 // pixels_ += a;
602 pixels_.Add(a);
603 return (*this);
604}
605
606/*! Substract a constant value \b a to a SphereHEALPix */
607template <class T>
608SphereHEALPix<T>& SphereHEALPix<T>::Sub(T a,bool fginv)
609{
610 if (NbPixels() < 1)
611 throw RangeCheckError("SphereHEALPix<T>::Sub(T ) - SphereHEALPix not dimensionned ! ");
612 pixels_.Sub(a,fginv);
613 return (*this);
614}
615
616/*! multiply a SphereHEALPix by a constant value \b a */
617template <class T>
618SphereHEALPix<T>& SphereHEALPix<T>::Mul(T a)
619{
620 if (NbPixels() < 1)
621 throw RangeCheckError("SphereHEALPix<T>::Mul(T ) - SphereHEALPix not dimensionned ! ");
622 pixels_ *= a;
623 return (*this);
624}
625
626/*! divide a SphereHEALPix by a constant value \b a */
627template <class T>
628SphereHEALPix<T>& SphereHEALPix<T>::Div(T a)
629{
630 if (NbPixels() < 1)
631 throw RangeCheckError("SphereHEALPix<T>::Div(T ) - SphereHEALPix not dimensionned ! ");
632 pixels_ /= a;
633 return (*this);
634}
635
636// >>>> Operations avec 2nd membre de type SphereHEALPix
637//! Add two SphereHEALPix
638
639template <class T>
640SphereHEALPix<T>& SphereHEALPix<T>::AddElt(const SphereHEALPix<T>& a)
641{
642 if (NbPixels() != a.NbPixels() )
643 {
644 throw(SzMismatchError("SphereHEALPix<T>::AddElt(const SphereHEALPix<T>&) SizeMismatch")) ;
645 }
646 pixels_ += a.pixels_;
647 return (*this);
648}
649
650//! Substract two SphereHEALPix
651template <class T>
652SphereHEALPix<T>& SphereHEALPix<T>::SubElt(const SphereHEALPix<T>& a)
653{
654 if (NbPixels() != a.NbPixels() )
655 {
656 throw(SzMismatchError("SphereHEALPix<T>::SubElt(const SphereHEALPix<T>&) SizeMismatch")) ;
657 }
658 pixels_ -= a.pixels_;
659 return (*this);
660}
661
662//! Multiply two SphereHEALPix (elements by elements)
663template <class T>
664SphereHEALPix<T>& SphereHEALPix<T>::MulElt(const SphereHEALPix<T>& a)
665{
666 if (NbPixels() != a.NbPixels() )
667 {
668 throw(SzMismatchError("SphereHEALPix<T>::MulElt(const SphereHEALPix<T>&) SizeMismatch")) ;
669 }
670 pixels_ *= a.pixels_;
671 return (*this);
672}
673
674//! Divide two SphereHEALPix (elements by elements) - No protection for divide by 0
675template <class T>
676SphereHEALPix<T>& SphereHEALPix<T>::DivElt(const SphereHEALPix<T>& a)
677{
678 if (NbPixels() != a.NbPixels() )
679 {
680 throw(SzMismatchError("SphereHEALPix<T>::DivElt(const SphereHEALPix<T>&) SizeMismatch")) ;
681 }
682 pixels_ /= a.pixels_;
683 return (*this);
684}
685
686
687
688
689template <class T>
690void SphereHEALPix<T>::print(ostream& os) const
691{
692 Show(os);
693 if(this->mInfo_) os << " DVList Info= " << *(this->mInfo_) << endl;
694 //
695 os << " nSide_ = " << nSide_ << endl;
696 os << " nPix_ = " << nPix_ << endl;
697 os << " omeg_ = " << omeg_ << endl;
698
699 os << " content of pixels : ";
700 for(int i=0; i < nPix_; i++)
701 {
702 if(i%5 == 0) os << endl;
703 os << pixels_(i) <<", ";
704 }
705 os << endl;
706
707
708}
709
710
711
712//*******************************************************************
713
714#ifdef __CXX_PRAGMA_TEMPLATES__
715#pragma define_template SphereHEALPix<uint_2>
716#pragma define_template SphereHEALPix<int_4>
717#pragma define_template SphereHEALPix<r_8>
718#pragma define_template SphereHEALPix<r_4>
719#pragma define_template SphereHEALPix< complex<r_4> >
720#pragma define_template SphereHEALPix< complex<r_8> >
721#endif
722#if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES)
723namespace SOPHYA {
724template class SphereHEALPix<uint_2>;
725template class SphereHEALPix<int_4>;
726template class SphereHEALPix<r_8>;
727template class SphereHEALPix<r_4>;
728template class SphereHEALPix< complex<r_4> >;
729template class SphereHEALPix< complex<r_8> >;
730}
731#endif
732
Note: See TracBrowser for help on using the repository browser.