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

Last change on this file since 3868 was 3836, checked in by ansari, 15 years ago

Declaration extern des classes templ des classes template avec instantiation explicite (avec flag NEED_EXT_DECL_TEMP) pour regler le pb de dynamic_cast sur Mac OS X 10.6, Reza 05/08/2010

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