source: Sophya/trunk/SophyaLib/SkyMap/sphereecp.h@ 2985

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

1/ Suite codage HEALPix-NEST , test avec transforme Ylm OK
2/ Petites modifs et corrections diverses (ajout SizeIndex2Resol() par exemple)

Reza 21 Juin 2006

File size: 5.6 KB
RevLine 
[2610]1#ifndef SPHEREECP_SEEN
2#define SPHEREECP_SEEN
3
4#include "sphericalmap.h"
5#include "ndatablock.h"
6#include "tvector.h"
7
8
9/* Classe de carte spherique avec decoupage theta-phi
10 (projection cylindique: Equatorial Cylindrical Projection)
11 avec couverture posiibilite de couverture partielle,
12 limites en theta,phi
13 R. Ansari - Septembre 2004
14 */
15
16namespace SOPHYA {
17template <class T>
18class FIO_SphereECP;
19
20template <class T>
21class SphereECP : public SphericalMap<T>
22{
23public :
[2973]24
25//! return the size index value corresponding to resolution res (in radian)
26static inline int_4 ResolToSizeIndex(double res)
[2978]27 { return (int_4)((M_PI/res)+0.5); }
[2985]28//! return the pixel resolution (in radian) for the size index \b m
29static inline double SizeIndexToResol(int_4 m)
30 { return (M_PI/(double)m); }
[2973]31
[2610]32 // Constructeur par defaut
33 SphereECP();
34 // Constructeur , couverture complete, m tranches en theta (delta theta = M_PI), 2m en phi (delta phi = 2Pi)
35 SphereECP(int m);
36 // Constructeur , couverture complete, ntet tranches en theta (delta theta = M_PI), nphi en phi (delta phi = 2Pi)
37 SphereECP(int ntet, int nphi);
38 // Constructeur , couverture partielle, ntet tranches en theta , nphi en phi
39 SphereECP(r_8 tet1, r_8 tet2, int ntet, r_8 phi1, r_8 phi2, int nphi);
40 // Constructeur de copie, share=true -> partage des pixels
41 SphereECP(const SphereECP<T>& a, bool share);
42 // Constructeur de copie, partage des pixels
43 SphereECP(const SphereECP<T>& a);
44 virtual ~SphereECP();
45
46// Renvoie TETAPHI comme les SphereThetaPhi pour le moment
47 virtual string TypeOfMap() const;
48 virtual void SetTemp(bool temp=false) const; // A supprimer
49
50// Informations sur carte partielle/complete + zone de couverture
51 inline bool IsPartial() const { return _partial; }
52 inline double MinTheta() const { return _theta1; }
53 inline double MaxTheta() const { return _theta2; }
54 inline double DeltaTheta() const { return _dtheta; }
55 inline double MinPhi() const { return _phi1; }
56 inline double MaxPhi() const { return _phi2; }
57 inline double DeltaPhi() const { return _dphi; }
58
59// Interface de Pixelmap
60/*! Return total number of pixels */
61 virtual int_4 NbPixels() const;
62
63/* retourne la valeur du pixel d'indice k */
64/*! Return value of pixel with index k */
65 virtual T& PixVal(int_4 k);
66 virtual T const& PixVal(int_4 k) const;
67
68/* Return true if teta,phi in map */
69 virtual bool ContainsSph(double theta, double phi) const;
70/* retourne l'indice du pixel a (theta,phi) */
71/* Return index of the pixel corresponding to direction (theta, phi). */
72 virtual int_4 PixIndexSph(double theta, double phi) const;
73
74/* retourne les coordonnees Spheriques du centre du pixel d'indice k */
75/*! Return (theta,phi) coordinates of middle of pixel with index k */
76 virtual void PixThetaPhi(int_4 k, double& theta, double& phi) const;
77
78/*! Setting pixel values to a constant */
79 virtual T SetPixels(T v);
80
81/* retourne/fixe l'angle Solide de Pixel (steradians) */
82/*! Pixel Solid angle (steradians)
83
84 All the pixels have the same solid angle. The dummy argument is
85 for compatibility with eventual pixelizations which would not
86 fulfil this requirement.
87*/
88 virtual double PixSolAngle(int_4 dummy=0) const;
[2623]89
90/* retourne/fixe l'angle Solide couvert par la carte (steradians) */
91 virtual double TotSolAngle(void) const
92 {return fabs((_phi2-_phi1)*(cos(_theta2)-cos(_theta1)));}
93
[2610]94/* retourne/fixe la valeur du parametre de decoupage m */
95 virtual int_4 SizeIndex() const ;
96
97// Interface de SphericalMap
98// index characterizing the size pixelization : m for SphereThetaPhi
99// nside for Gorski sphere...
100 virtual void Resize(int_4 m);
101 virtual uint_4 NbThetaSlices() const;
102
103 // Nb de tranches en Phi
104 inline uint_4 NbPhiSlices() const { return _pixels.SizeX(); }
105
[2968]106 virtual r_8 ThetaOfSlice(int_4 index) const;
[2610]107 virtual void GetThetaSlice(int_4 index,r_8& theta,
108 TVector<r_8>& phi, TVector<T>& value) const ;
109 virtual void GetThetaSlice(int_4 sliceIndex, r_8& theta, r_8& phi0,
110 TVector<int_4>& pixelIndices,TVector<T>& value) const ;
111
112 // Valeur de pixel hors carte
113 inline void SetOutOfMapValue(T v) { _outofmappix = _outofmapval = v; }
114 inline T GetOutOfMapValue(T v) { return _outofmapval; }
115
116 // Impression
[2973]117 virtual void Show(ostream& os) const;
[2610]118 virtual void Print(ostream& os) const;
119 inline void print(ostream& os) const { Print(os); }
[2973]120 inline void Print() const { Print(cout); }
[2610]121
122 // ---- les operations =, +, - , *
123 // operation = (remplissage avec une valeur ou carte)
124 virtual SphereECP<T>& Set(const SphereECP<T>& a);
125 inline SphereECP<T>& operator = (const SphereECP<T>& a) { return Set(a); }
126 virtual SphereECP<T>& SetCst(T x);
127 inline SphereECP<T>& operator = (T x) { return SetCst(x); }
128 // Operation + , * avec des Constantes
129 virtual SphereECP<T>& AddCst(T x) ;
130 virtual SphereECP<T>& MulCst(T x) ;
131
132 inline SphereECP<T>& operator += (T x) { return AddCst(x); }
133 inline SphereECP<T>& operator -= (T x) { return AddCst(-x); }
134 inline SphereECP<T>& operator *= (T x) { return MulCst(x); }
135
136 // Acces au tableau des pixels
137 inline TArray<T>& GetPixelArray() { return _pixels; }
138 inline TArray<T> GetPixelArray() const { return _pixels; }
139
140 friend class FIO_SphereECP<T>; // Gestion de persistance PPF
141
142protected:
143 bool _partial;
144 r_8 _theta1,_theta2;
145 r_8 _phi1, _phi2;
146 r_8 _dtheta, _dphi;
147 TArray<T> _pixels;
148 int_4 _outofmapidx;
[2621]149 int_4 _outofmapnphi;
150 int_4 _outofmapntet;
[2610]151 T _outofmappix;
152 T _outofmapval;
153};
154
155
156}// Fin du namespace
157
158#endif
Note: See TracBrowser for help on using the repository browser.