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

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

Ajout methode ThetaOfSlice() a l'interface SphericalMap et propagation , Reza 06/06/2006

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