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