source: Sophya/trunk/SophyaLib/SkyMap/spherehealpix.h@ 1383

Last change on this file since 1383 was 1217, checked in by ansari, 25 years ago

doc dans les .cc

File size: 4.5 KB
RevLine 
[843]1#ifndef SPHEREHEALPIX_SEEN
2#define SPHEREHEALPIX_SEEN
3
4#include "sphericalmap.h"
5#include "tvector.h"
6#include "ndatablock.h"
7
8#include "anydataobj.h"
9#include "ppersist.h"
10
[1196]11#include "HEALPixUtils.h"
[843]12
13namespace SOPHYA {
14
15
[853]16// ***************** CLASSE SphereHEALPix *****************************
[843]17
[1217]18 /*! Class SphereHEALPix */
[843]19
20
21template<class T>
[853]22class FIO_SphereHEALPix;
[843]23
24template<class T>
[853]25class FITS_SphereHEALPix;
[843]26
27template<class T>
[853]28class SphereHEALPix : public SphericalMap<T>
[843]29{
[1196]30public :
31// Static Methods to ease the use of HEALPix index <> angle conversion methods
[843]32
[1196]33 static inline int_4 nest2ring(int_4 nside,int_4 ipnest)
34 { return HEALPix::nest2ring(nside, ipnest); }
35 static inline int_4 ring2nest(int_4 nside,int_4 ipring)
36 { return HEALPix::ring2nest(nside, ipring); }
37 static inline int_4 ang2pix_ring(int_4 nside,double theta,double phi)
38 { return HEALPix::ang2pix_ring(nside, theta, phi); }
39 static inline int_4 ang2pix_nest(int_4 nside,double theta,double phi)
40 { return HEALPix::ang2pix_nest(nside, theta, phi); }
41 static inline void pix2ang_ring(int_4 nside,int_4 ipix,double& theta,double& phi)
42 { HEALPix::pix2ang_ring(nside, ipix, theta, phi); }
43 static inline void pix2ang_nest(int_4 nside,int_4 ipix,double& theta,double& phi)
44 { HEALPix::pix2ang_nest(nside, ipix, theta, phi); }
[843]45
[853]46SphereHEALPix();
47SphereHEALPix(int_4 m);
[906]48SphereHEALPix(const SphereHEALPix<T>& s, bool share);
49SphereHEALPix(const SphereHEALPix<T>& s);
[853]50virtual ~SphereHEALPix();
[843]51
[908]52inline virtual bool IsTemp(void) const {
53
54 if (sliceBeginIndex_.IsTemp() != pixels_.IsTemp() || sliceLenght_.IsTemp() != pixels_.IsTemp() )
55 throw PException(" l'etat 'temporaire' de la spherehealpix est incoherent");
56 return pixels_.IsTemp();
57}
[1217]58
[843]59inline virtual void SetTemp(bool temp=false) const
60 {
61 pixels_.SetTemp(temp);
62 sliceBeginIndex_.SetTemp(temp);
63 sliceLenght_.SetTemp(temp);
64 };
65// ------------------ Definition of PixelMap abstract methods
66
67virtual int_4 NbPixels() const;
68
69virtual T& PixVal(int_4 k);
70virtual T const& PixVal(int_4 k) const;
71
72uint_4 NbThetaSlices() const;
73virtual void GetThetaSlice(int_4 index,r_8& theta,TVector<r_8>& phi,TVector<T>& value) const;
74virtual void GetThetaSlice(int_4 sliceIndex,r_8& theta, r_8& phi0, TVector<int_4>& pixelIndices,TVector<T>& value) const ;
75
76virtual bool ContainsSph(double theta, double phi) const;
77virtual int_4 PixIndexSph(double theta,double phi) const;
78
79virtual void PixThetaPhi(int_4 k,double& theta,double& phi) const;
80
81virtual T SetPixels(T v);
82
[1217]83/*! Pixel Solid angle (steradians)
[843]84
85 All the pixels have the same solid angle. The dummy argument is
86 for compatibility with eventual pixelizations which would not
87 fulfil this requirement.
88*/
[1217]89inline virtual double PixSolAngle(int_4 dummy=0) const {return omeg_;}
[843]90
91/* Acces to the DataBlock */
92inline NDataBlock<T>& DataBlock() {return pixels_;}
93inline const NDataBlock<T>& DataBlock() const {return pixels_;}
94
95// --------------- Specific methods
96
[1217]97virtual void Resize(int_4 m);
[843]98
[1217]99/*!
[843]100
[1217]101\return type of storage of the map : RING or NESTED
102
103at the moment, always RING
[843]104*/
105inline virtual char* TypeOfMap() const {return "RING";};
106
107
108virtual T& PixValNest(int_4 k);
109virtual T const& PixValNest(int_4 k) const;
110
111virtual int_4 PixIndexSphNest(double theta,double phi) const;
112
113virtual void PixThetaPhiNest(int_4 k,double& theta,double& phi) const;
114
115void Pixelize(int_4);
116
117int_4 NestToRing(int_4) const;
118
119int_4 RingToNest(int_4) const;
120
121
[1217]122/*! \return value of healpix nside */
[843]123inline virtual int_4 SizeIndex() const {return(nSide_);}
124
125void print(ostream& os) const;
[892]126
127
128
129inline SphereHEALPix<T>& operator = (const SphereHEALPix<T>& a)
[980]130 {return Set(a);}
[1195]131
[1196]132 void CloneOrShare(const SphereHEALPix<T>& a);
133 SphereHEALPix<T>& Set(const SphereHEALPix<T>& a);
134 SphereHEALPix<T>& CopyElt(const SphereHEALPix<T>& a);
135
136
137 // friend declaration for classes which handle persistence and FITS IO
138 friend class FIO_SphereHEALPix<T>;
139 friend class FITS_SphereHEALPix<T>;
[1195]140
[1196]141protected :
[843]142
143// ------------- méthodes internes ----------------------
144void InitNul();
145void SetThetaSlices();
146
147inline void setParameters(int_4 nside, int_4 nbpixels, double solangle)
148 {
149 nSide_= nside;
150 nPix_= nbpixels;
151 omeg_= solangle;
152 }
153
154// ------------- variables internes -----------------------
155
156int_4 nSide_;
157int_4 nPix_;
158double omeg_;
159
160NDataBlock<T> pixels_;
[1217]161NDataBlock<int_4> sliceBeginIndex_; // Rationalisation Mac. D.Y.
[1145]162NDataBlock<int_4> sliceLenght_;
[843]163
164};
165
166
167
168} // Fin du namespace
169
170#endif
Note: See TracBrowser for help on using the repository browser.