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

Last change on this file since 2610 was 2610, checked in by ansari, 21 years ago

Ajout classe SphereECP<T> avec sa gestionnaire PPersist - Reza , 7 Septembre 2004

File size: 5.0 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 la valeur du parametre de decoupage m */
83 virtual int_4 SizeIndex() const ;
84
85// Interface de SphericalMap
86// index characterizing the size pixelization : m for SphereThetaPhi
87// nside for Gorski sphere...
88 virtual void Resize(int_4 m);
89 virtual uint_4 NbThetaSlices() const;
90
91 // Nb de tranches en Phi
92 inline uint_4 NbPhiSlices() const { return _pixels.SizeX(); }
93
94 virtual void GetThetaSlice(int_4 index,r_8& theta,
95 TVector<r_8>& phi, TVector<T>& value) const ;
96 virtual void GetThetaSlice(int_4 sliceIndex, r_8& theta, r_8& phi0,
97 TVector<int_4>& pixelIndices,TVector<T>& value) const ;
98
99 // Valeur de pixel hors carte
100 inline void SetOutOfMapValue(T v) { _outofmappix = _outofmapval = v; }
101 inline T GetOutOfMapValue(T v) { return _outofmapval; }
102
103 // Impression
104 virtual void Print(ostream& os) const;
105 inline void print(ostream& os) const { Print(os); }
106
107 // ---- les operations =, +, - , *
108 // operation = (remplissage avec une valeur ou carte)
109 virtual SphereECP<T>& Set(const SphereECP<T>& a);
110 inline SphereECP<T>& operator = (const SphereECP<T>& a) { return Set(a); }
111 virtual SphereECP<T>& SetCst(T x);
112 inline SphereECP<T>& operator = (T x) { return SetCst(x); }
113 // Operation + , * avec des Constantes
114 virtual SphereECP<T>& AddCst(T x) ;
115 virtual SphereECP<T>& MulCst(T x) ;
116
117 inline SphereECP<T>& operator += (T x) { return AddCst(x); }
118 inline SphereECP<T>& operator -= (T x) { return AddCst(-x); }
119 inline SphereECP<T>& operator *= (T x) { return MulCst(x); }
120
121 // Acces au tableau des pixels
122 inline TArray<T>& GetPixelArray() { return _pixels; }
123 inline TArray<T> GetPixelArray() const { return _pixels; }
124
125 friend class FIO_SphereECP<T>; // Gestion de persistance PPF
126
127protected:
128 bool _partial;
129 r_8 _theta1,_theta2;
130 r_8 _phi1, _phi2;
131 r_8 _dtheta, _dphi;
132 TArray<T> _pixels;
133 int_4 _outofmapidx;
134 T _outofmappix;
135 T _outofmapval;
136};
137
138template <class T>
139inline ostream& operator << (ostream& os, const SphereECP<T>& a)
140 { a.Print(os); return(os); }
141
142}// Fin du namespace
143
144#endif
Note: See TracBrowser for help on using the repository browser.