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

Last change on this file since 4066 was 4066, checked in by ansari, 13 years ago

Ajout gestion de niveau d'impression globale pour les cartes du module SkyMap ds pixelmap.h et prise en compte du niveau pour les prints ds Resize des SphericalMaps (fait en janv 2012 ?), Reza 27/04/2012

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 if (PixelMap_GetGlobalPrintLevel()>0)
211 cout << "SphereHEALPix<T>::Resize(m) with m<=0, NOT resized" << endl;
212 return;
213 }
214 InitNul();
215 Pixelize(m);
216 SetThetaSlices();
217}
218
219
220//! return type of the map pixelisation : RING or NESTED
221template<class T>
222string SphereHEALPix<T>::TypeOfMap() const
223{
224 if (fgring_) return string("RING");
225 else return string("NESTED");
226}
227
228template<class T>
229void SphereHEALPix<T>::Pixelize( int_4 m)
230// prépare la pixelisation Gorski (m a la même signification
231// que pour le constructeur)
232{
233 if (m<=0 || m> 8192) {
234 cout << "SphereHEALPix<T>::Pixelize() m=" << m <<" out of range [0,8192]" << endl;
235 throw ParmError("SphereHEALPix<T>::Pixelize() m out of range");
236 }
237 // verifier que m est une puissance de deux
238 int x= m;
239 while (x%2==0) x/=2;
240 if(x != 1) {
241 cout << "SphereHEALPix<T>::Pixelize() m=" << m << " != 2^n " << endl;
242 throw ParmError("SphereHEALPix<T>::Pixelize() m!=2^n");
243 }
244
245 // On memorise les arguments d'appel
246 nSide_= m;
247
248 // Nombre total de pixels sur la sphere entiere
249 nPix_= 12*nSide_*nSide_;
250
251 // pour le moment les tableaux qui suivent seront ranges dans l'ordre
252 // de l'indexation GORSKY "RING"
253 // on pourra ulterieurement changer de strategie et tirer profit
254 // de la dualite d'indexation GORSKY (RING et NEST) : tout dependra
255 // de pourquoi c'est faire
256
257 // Creation et initialisation du vecteur des contenus des pixels
258 pixels_.ReSize(nPix_);
259 pixels_.Reset();
260
261 // solid angle per pixel
262 omeg_= 4.0*Pi/nPix_;
263}
264
265template<class T>
266void SphereHEALPix<T>::InitNul()
267//
268// initialise à zéro les variables de classe
269{
270 nSide_= 0;
271 nPix_ = 0;
272 omeg_ = 0.;
273// pixels_.Reset(); - Il ne faut pas mettre les pixels a zero si share !
274}
275
276/* --Methode-- */
277/* Nombre de pixels du decoupage */
278/*! \fn int_4 SOPHYA::SphereHEALPix::NbPixels() const
279
280 Return number of pixels of the splitting
281*/
282template<class T>
283int_4 SphereHEALPix<T>::NbPixels() const
284{
285 return(nPix_);
286}
287
288
289/*! \fn uint_4 SOPHYA::SphereHEALPix::NbThetaSlices() const
290
291 \return number of slices in theta direction on the sphere
292*/
293template<class T>
294uint_4 SphereHEALPix<T>::NbThetaSlices() const
295{
296 uint_4 nbslices = uint_4(4*nSide_-1);
297 if (nSide_<=0) {
298 nbslices = 0;
299 throw PException(" sphere not pixelized, NbSlice=0 ");
300 }
301 return nbslices;
302}
303
304//! Return the theta angle for slice defined by \b index
305template<class T>
306r_8 SphereHEALPix<T>::ThetaOfSlice(int_4 index) const
307{
308 uint_4 nbslices = uint_4(4*nSide_-1);
309 if (index<0 || index >= (int_4)nbslices)
310 throw RangeCheckError(" SphereHEALPix::ThetaOfSlice() index out of range");
311 r_8 theta, phi0;
312 PixThetaPhi(sliceBeginIndex_(index), theta, phi0);
313 return theta;
314}
315
316//! Return true : All theta slices have a symmetric slice at Pi-Theta in SphereHEALPix
317template <class T>
318bool SphereHEALPix<T>::HasSymThetaSlice() const
319{
320 return true;
321}
322//! Return the slice index for the symmetric slice at theta=Pi-ThetaOfSlice(idx)
323template <class T>
324int_4 SphereHEALPix<T>::GetSymThetaSliceIndex(int_4 idx) const
325{
326 if(idx < 0 || idx >= (int_4)NbThetaSlices())
327 throw RangeCheckError("SphereHEALPix::GetSymThetaSliceIndex index out of range");
328 return (NbThetaSlices()-1-idx);
329}
330
331/*! \fn void SOPHYA::SphereHEALPix::GetThetaSlice(int_4 index,r_8& theta,TVector<r_8>& phi,TVector<T>& value) const
332
333 For a theta-slice with index 'index', return :
334
335 the corresponding "theta"
336
337 a vector containing the phi's of the pixels of the slice
338
339 a vector containing the corresponding values of pixels
340*/
341template<class T>
342void SphereHEALPix<T>::GetThetaSlice(int_4 index,r_8& theta,TVector<r_8>& phi,TVector<T>& value) const
343{
344 if (index<0 || index >= (int_4)NbThetaSlices())
345 throw RangeCheckError(" SphereHEALPix::GetThetaSlice() index out of range");
346
347 int_4 iring= sliceBeginIndex_(index);
348 int_4 lring = sliceLenght_(index);
349
350 phi.ReSize(lring);
351 value.ReSize(lring);
352
353 double TH= 0.;
354 double FI= 0.;
355 if (fgring_) { // RING pixelisation scheme
356 for(int_4 kk = 0; kk < lring;kk++) {
357 PixThetaPhi(kk+iring,TH,FI);
358 phi(kk)= FI;
359 value(kk)= pixels_(kk+iring);
360 }
361 PixThetaPhi(iring, theta, FI);
362 }
363 else { // NESTED pixelisation scheme
364 for(int_4 kk = 0; kk < lring;kk++) {
365 int kkn = ring2nest(nSide_, kk+iring);
366 PixThetaPhi(kkn,TH,FI);
367 phi(kk)= FI;
368 value(kk)= pixels_(kkn);
369 }
370 PixThetaPhi(ring2nest(nSide_,iring), theta, FI);
371 }
372 // theta= TH;
373}
374/*! \fn void SOPHYA::SphereHEALPix::GetThetaSlice(int_4 sliceIndex,r_8& theta, r_8& phi0, TVector<int_4>& pixelIndices,TVector<T>& value) const
375
376 For a theta-slice with index 'index', return :
377
378 the corresponding "theta"
379
380 the corresponding "phi" for first pixel of the slice
381
382 a vector containing indices of the pixels of the slice
383
384 (equally distributed in phi)
385
386 a vector containing the corresponding values of pixels
387*/
388
389template<class T>
390void SphereHEALPix<T>::GetThetaSlice(int_4 sliceIndex,r_8& theta, r_8& phi0,
391 TVector<int_4>& pixelIndices,TVector<T>& value) const
392
393{
394
395 if (sliceIndex<0 || sliceIndex >= (int_4)NbThetaSlices())
396 throw RangeCheckError(" SphereHEALPix::GetThetaSlice() index out of range");
397 int_4 iring= sliceBeginIndex_(sliceIndex);
398 int_4 lring = sliceLenght_(sliceIndex);
399 pixelIndices.ReSize(lring);
400 value.ReSize(lring);
401
402 if (fgring_) { // RING pixelisation scheme
403 for(int_4 kk = 0; kk < lring;kk++) {
404 pixelIndices(kk)= kk+iring;
405 value(kk)= pixels_(kk+iring);
406 }
407 PixThetaPhi(iring, theta, phi0);
408 }
409 else { // NESTED pixelisation scheme
410 for(int_4 kk = 0; kk < lring;kk++) {
411 int_4 kkn = ring2nest(nSide_, kk+iring);
412 pixelIndices(kk)= kkn;
413 value(kk)= pixels_(kkn);
414 }
415 PixThetaPhi(ring2nest(nSide_,iring), theta, phi0);
416 }
417}
418
419//! return a pointer to the specified slice pixel data in RING ordering, NULL in NESTED
420template<class T>
421T* SphereHEALPix<T>::GetThetaSliceDataPtr(int_4 sliceIndex)
422
423{
424 if (sliceIndex<0 || sliceIndex >= (int_4)NbThetaSlices())
425 throw RangeCheckError(" SphereHEALPix::GetThetaSliceDataPtr(): index out of range");
426 if (fgring_)
427 return pixels_.Begin()+sliceBeginIndex_(sliceIndex);
428 else return NULL;
429}
430
431template<class T>
432void SphereHEALPix<T>::SetThetaSlices()
433{
434 sliceBeginIndex_.ReSize(4*nSide_-1);
435 sliceLenght_.ReSize(4*nSide_-1);
436 int_4 sliceIndex;
437 int_4 offp = 0;
438 for (sliceIndex=0; sliceIndex< nSide_-1; sliceIndex++) {
439 // sliceBeginIndex_(sliceIndex) = 2*sliceIndex*(sliceIndex+1);
440 sliceBeginIndex_(sliceIndex) = offp;
441 sliceLenght_(sliceIndex) = 4*(sliceIndex+1);
442 offp += sliceLenght_(sliceIndex);
443 }
444 for (sliceIndex= nSide_-1; sliceIndex< 3*nSide_; sliceIndex++) {
445 // sliceBeginIndex_(sliceIndex) = 2*nSide_*(2*sliceIndex-nSide_+1);
446 sliceBeginIndex_(sliceIndex) = offp;
447 sliceLenght_(sliceIndex) = 4*nSide_;
448 offp += sliceLenght_(sliceIndex);
449 }
450 for (sliceIndex= 3*nSide_; sliceIndex< 4*nSide_-1; sliceIndex++) {
451 int_4 nc= 4*nSide_-1-sliceIndex;
452 // sliceBeginIndex_(sliceIndex) = nPix_-2*nc*(nc+1);
453 sliceBeginIndex_(sliceIndex) = offp;
454 sliceLenght_(sliceIndex) = 4*nc;
455 offp += sliceLenght_(sliceIndex);
456 }
457}
458
459
460
461//! \return value of the \b k th pixel
462template<class T>
463T& SphereHEALPix<T>::PixVal(int_4 k)
464
465{
466 if((k < 0) || (k >= nPix_))
467 throw RangeCheckError("SphereHEALPix::PixVal() Pixel index out of range");
468 return pixels_(k);
469}
470
471//! \return value of the \b k th pixel
472template<class T>
473T const& SphereHEALPix<T>::PixVal(int_4 k) const
474
475{
476 if((k < 0) || (k >= nPix_))
477 throw RangeCheckError("SphereHEALPix::PIxVal Pixel index out of range");
478 return *(pixels_.Data()+k);
479}
480
481
482/*! \fn bool SOPHYA::SphereHEALPix::ContainsSph(double theta, double phi) const
483
484\return true if teta,phi in map
485*/
486template<class T>
487bool SphereHEALPix<T>::ContainsSph(double theta, double phi) const
488{
489return(true);
490}
491
492/*! \fn int_4 SOPHYA::SphereHEALPix::PixIndexSph(double theta,double phi) const
493
494 \return "RING" index of the pixel corresponding to direction (theta, phi).
495 */
496template<class T>
497int_4 SphereHEALPix<T>::PixIndexSph(double theta,double phi) const
498
499{
500 if (fgring_) return ang2pix_ring(nSide_,theta,phi);
501 else return ang2pix_nest(nSide_,theta,phi);
502}
503
504
505//! \return (theta,phi) coordinates of middle of pixel with "RING" index k
506template<class T>
507void SphereHEALPix<T>::PixThetaPhi(int_4 k,double& theta,double& phi) const
508{
509 if (fgring_) pix2ang_ring(nSide_,k,theta,phi);
510 else pix2ang_nest(nSide_,k,theta,phi);
511}
512
513//! Set all pixels to value v
514template <class T>
515T SphereHEALPix<T>::SetPixels(T v)
516{
517pixels_.Reset(v);
518return(v);
519}
520
521
522
523//! Conversion from NESTED index into RING index
524template<class T>
525int_4 SphereHEALPix<T>::NestToRing(int_4 k) const
526{
527 return nest2ring(nSide_,k);
528}
529
530//! Conversion from RING index into NESTED index
531template<class T>
532int_4 SphereHEALPix<T>::RingToNest(int_4 k) const
533{
534 return ring2nest(nSide_,k);
535}
536
537// ...... Operations de calcul ......
538
539//! Fill a SphereHEALPix with a constant value \b a
540template <class T>
541SphereHEALPix<T>& SphereHEALPix<T>::SetT(T a)
542{
543 if (NbPixels() < 1)
544 throw RangeCheckError("SphereHEALPix<T>::SetT(T ) - SphereHEALPix not dimensionned ! ");
545 pixels_ = a;
546 return (*this);
547}
548
549//! Add a constant value \b x to a SphereHEALPix
550template <class T>
551SphereHEALPix<T>& SphereHEALPix<T>::Add(T a)
552 {
553 cout << " c'est mon Add " << endl;
554 if (NbPixels() < 1)
555 throw RangeCheckError("SphereHEALPix<T>::Add(T ) - SphereHEALPix not dimensionned ! ");
556 // pixels_ += a;
557 pixels_.Add(a);
558 return (*this);
559}
560
561/*! Substract a constant value \b a to a SphereHEALPix */
562template <class T>
563SphereHEALPix<T>& SphereHEALPix<T>::Sub(T a,bool fginv)
564{
565 if (NbPixels() < 1)
566 throw RangeCheckError("SphereHEALPix<T>::Sub(T ) - SphereHEALPix not dimensionned ! ");
567 pixels_.Sub(a,fginv);
568 return (*this);
569}
570
571/*! multiply a SphereHEALPix by a constant value \b a */
572template <class T>
573SphereHEALPix<T>& SphereHEALPix<T>::Mul(T a)
574{
575 if (NbPixels() < 1)
576 throw RangeCheckError("SphereHEALPix<T>::Mul(T ) - SphereHEALPix not dimensionned ! ");
577 pixels_ *= a;
578 return (*this);
579}
580
581/*! divide a SphereHEALPix by a constant value \b a */
582template <class T>
583SphereHEALPix<T>& SphereHEALPix<T>::Div(T a)
584{
585 if (NbPixels() < 1)
586 throw RangeCheckError("SphereHEALPix<T>::Div(T ) - SphereHEALPix not dimensionned ! ");
587 pixels_ /= a;
588 return (*this);
589}
590
591// >>>> Operations avec 2nd membre de type SphereHEALPix
592//! Add two SphereHEALPix
593
594template <class T>
595SphereHEALPix<T>& SphereHEALPix<T>::AddElt(const SphereHEALPix<T>& a)
596{
597 if (NbPixels() != a.NbPixels() )
598 throw(SzMismatchError("SphereHEALPix<T>::AddElt(a) SizeMismatch")) ;
599 if (fgring_ != a.fgring_)
600 throw(ParmError("SphereHEALPix<T>::AddElt(a) different pixelisation RING<>NESTED")) ;
601
602 pixels_ += a.pixels_;
603 return (*this);
604}
605
606//! Substract two SphereHEALPix
607template <class T>
608SphereHEALPix<T>& SphereHEALPix<T>::SubElt(const SphereHEALPix<T>& a)
609{
610 if (NbPixels() != a.NbPixels() )
611 throw(SzMismatchError("SphereHEALPix<T>::SubElt(a) SizeMismatch")) ;
612 if (fgring_ != a.fgring_)
613 throw(ParmError("SphereHEALPix<T>::SubElt(a) different pixelisation RING<>NESTED")) ;
614
615 pixels_ -= a.pixels_;
616 return (*this);
617}
618
619//! Multiply two SphereHEALPix (elements by elements)
620template <class T>
621SphereHEALPix<T>& SphereHEALPix<T>::MulElt(const SphereHEALPix<T>& a)
622{
623 if (NbPixels() != a.NbPixels() )
624 throw(SzMismatchError("SphereHEALPix<T>::MulElt(a) SizeMismatch")) ;
625 if (fgring_ != a.fgring_)
626 throw(ParmError("SphereHEALPix<T>::MulElt(a) different pixelisation RING<>NESTED")) ;
627
628 pixels_ *= a.pixels_;
629 return (*this);
630}
631
632//! Divide two SphereHEALPix (elements by elements) - No protection for divide by 0
633template <class T>
634SphereHEALPix<T>& SphereHEALPix<T>::DivElt(const SphereHEALPix<T>& a)
635{
636 if (NbPixels() != a.NbPixels() )
637 throw(SzMismatchError("SphereHEALPix<T>::DivElt(a) SizeMismatch")) ;
638 if (fgring_ != a.fgring_)
639 throw(ParmError("SphereHEALPix<T>::DivElt(a) different pixelisation RING<>NESTED")) ;
640 pixels_ /= a.pixels_;
641 return (*this);
642}
643
644
645
646
647template <class T>
648void SphereHEALPix<T>::print(ostream& os) const
649{
650 this->Show(os);
651 os << "SphereHEALPix<T>(" << TypeOfMap() << ") NSide= "
652 << nSide_ << " nPix_ = " << nPix_ << " omeg_ = " << omeg_ << endl;
653
654 if(this->mInfo_) os << " DVList Info= " << *(this->mInfo_) << endl;
655 os << "... Pixel values : ";
656 for(int i=0; i < nPix_; i++)
657 {
658 if(i%5 == 0) os << endl;
659 os << pixels_(i) <<", ";
660 }
661 os << endl;
662
663
664}
665
666
667
668//*******************************************************************
669
670#ifdef __CXX_PRAGMA_TEMPLATES__
671#pragma define_template SphereHEALPix<uint_2>
672#pragma define_template SphereHEALPix<int_4>
673#pragma define_template SphereHEALPix<r_8>
674#pragma define_template SphereHEALPix<r_4>
675#pragma define_template SphereHEALPix< complex<r_4> >
676#pragma define_template SphereHEALPix< complex<r_8> >
677#endif
678#if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES)
679namespace SOPHYA {
680template class SphereHEALPix<uint_2>;
681template class SphereHEALPix<int_4>;
682template class SphereHEALPix<r_8>;
683template class SphereHEALPix<r_4>;
684template class SphereHEALPix< complex<r_4> >;
685template class SphereHEALPix< complex<r_8> >;
686}
687#endif
688
Note: See TracBrowser for help on using the repository browser.