1 | #ifndef SPHERETHETAPHI_SEEN
|
---|
2 | #define SPHERETHETAPHI_SEEN
|
---|
3 |
|
---|
4 | #include "sphericalmap.h"
|
---|
5 | #include "ndatablock.h"
|
---|
6 | #include "tvector.h"
|
---|
7 |
|
---|
8 | #include "anydataobj.h"
|
---|
9 | #include "ppersist.h"
|
---|
10 |
|
---|
11 | // ***************** Class SphereThetaPhi *****************************
|
---|
12 |
|
---|
13 | template <class T>
|
---|
14 | class SphereThetaPhi : public SphericalMap<T>, public AnyDataObj
|
---|
15 | {
|
---|
16 |
|
---|
17 | public :
|
---|
18 |
|
---|
19 | SphereThetaPhi();
|
---|
20 | SphereThetaPhi(int m);
|
---|
21 | SphereThetaPhi(const SphereThetaPhi<T>& s);
|
---|
22 | virtual ~SphereThetaPhi();
|
---|
23 |
|
---|
24 | // ------------ Definition of PixelMap abstract methods -
|
---|
25 |
|
---|
26 | /* retourne/fixe le nombre de pixels */
|
---|
27 | virtual int NbPixels() const;
|
---|
28 | inline void setNbPixels(int nbpix) { NPix_= nbpix; }
|
---|
29 |
|
---|
30 | /* retourne la valeur du pixel d'indice k */
|
---|
31 | virtual T& PixVal(int k);
|
---|
32 | virtual T const& PixVal(int k) const;
|
---|
33 |
|
---|
34 | /* retourne l'indice du pixel a (theta,phi) */
|
---|
35 | virtual int PixIndexSph(double theta, double phi) const;
|
---|
36 |
|
---|
37 | /* retourne les coordonnees Spheriques du centre du pixel d'indice k */
|
---|
38 | virtual void PixThetaPhi(int k, double& theta, double& phi) const;
|
---|
39 |
|
---|
40 | /* retourne/fixe l'angle Solide de Pixel (steradians) */
|
---|
41 | virtual double PixSolAngle(int dummy) const;
|
---|
42 | inline void setPixSolAngle(double omega) { Omega_= omega; }
|
---|
43 |
|
---|
44 | /* retourne/fixe la valeur du parametre de decoupage m */
|
---|
45 | inline virtual int SizeIndex() const { return( NTheta_); }
|
---|
46 | inline void setSizeIndex(int nbindex) { NTheta_= nbindex; }
|
---|
47 |
|
---|
48 | // ------------- Specific methods ----------------------
|
---|
49 |
|
---|
50 | virtual void Resize(int m);
|
---|
51 |
|
---|
52 | inline virtual char* TypeOfMap() const {return "TETAFI";};
|
---|
53 |
|
---|
54 | /* Valeurs de theta des paralleles et phi des meridiens limitant le pixel d'indice k */
|
---|
55 | virtual void Limits(int k,double& th1,double& th2,double& phi1,double& phi2);
|
---|
56 |
|
---|
57 | /* Nombre de tranches en theta */
|
---|
58 | int NbThetaSlices() const;
|
---|
59 |
|
---|
60 | /* Nombre de pixels en phi de la tranche d'indice kt */
|
---|
61 | int NPhi(int kt) const;
|
---|
62 |
|
---|
63 | /* Renvoie dans t1,t2 les valeurs respectives de theta min et theta max */
|
---|
64 | /* de la tranche d'indice kt */
|
---|
65 | void Theta(int kt, double& t1, double& t2);
|
---|
66 |
|
---|
67 | /* Renvoie dans p1,p2 les valeurs phimin et phimax du pixel d'indice jp */
|
---|
68 | /* dans la tranche d'indice kt */
|
---|
69 | void Phi(int kt, int jp, double& p1, double& p2);
|
---|
70 |
|
---|
71 | /* Renvoie l'indice k du pixel d'indice jp dans la tranche d'indice kt */
|
---|
72 | int Index(int kt, int jp) const;
|
---|
73 |
|
---|
74 | /* Indice kt de la tranche et indice jp du pixel d'indice k */
|
---|
75 | void ThetaPhiIndex(int k,int& kt,int& jp);
|
---|
76 |
|
---|
77 | void Pixelize(int);
|
---|
78 |
|
---|
79 | void GetThetaSlice(int index,double& theta,TVector<double>& phi,TVector<T>& value) const;
|
---|
80 |
|
---|
81 | /*retourne le tableau contenant le nombre de pixels en phi de chacune des bandes en theta */
|
---|
82 | inline const int* getmNPhi() const { return(NPhi_); }
|
---|
83 | void setmNPhi(int* array, int m);
|
---|
84 |
|
---|
85 | /* retourne/remplit le tableau contenant le nombre/Deuxpi total des pixels contenus dans les bandes */
|
---|
86 | inline const int* getmTNphi() const { return(TNphi_); }
|
---|
87 | void setmTNphi(int* array, int m);
|
---|
88 |
|
---|
89 | /* retourne/remplit le tableau contenant les valeurs limites de theta */
|
---|
90 | inline const double* getmTheta() const { return(Theta_); }
|
---|
91 | void setmTheta(double* array, int m);
|
---|
92 |
|
---|
93 | /* retourne le pointeur vers/remplit le vecteur des contenus des pixels */
|
---|
94 | inline const NDataBlock<T>* getDataBlock() const { return (&pixels_); }
|
---|
95 | void setDataBlock(T* data, int m);
|
---|
96 |
|
---|
97 | /* impression */
|
---|
98 | void print(ostream& os) const;
|
---|
99 |
|
---|
100 | private :
|
---|
101 |
|
---|
102 | // ------------- méthodes internes ----------------------
|
---|
103 | void InitNul();
|
---|
104 | void Clear();
|
---|
105 |
|
---|
106 | // ------------- variables internes ---------------------
|
---|
107 | int NTheta_;
|
---|
108 | int NPix_;
|
---|
109 | double Omega_;
|
---|
110 | int* NPhi_;
|
---|
111 | int* TNphi_;
|
---|
112 | double* Theta_;
|
---|
113 | NDataBlock<T> pixels_;
|
---|
114 | };
|
---|
115 |
|
---|
116 | // ------------- Classe pour la gestion de persistance --
|
---|
117 | template <class T>
|
---|
118 | class FIO_SphereThetaPhi : public PPersist
|
---|
119 | {
|
---|
120 | public:
|
---|
121 |
|
---|
122 | FIO_SphereThetaPhi();
|
---|
123 | FIO_SphereThetaPhi(string const & filename);
|
---|
124 | FIO_SphereThetaPhi(const SphereThetaPhi<T>& obj);
|
---|
125 | FIO_SphereThetaPhi(SphereThetaPhi<T>* obj);
|
---|
126 | virtual ~FIO_SphereThetaPhi();
|
---|
127 | virtual AnyDataObj* DataObj();
|
---|
128 | inline operator SphereThetaPhi<T>() { return(*dobj); }
|
---|
129 | inline SphereThetaPhi<T> getObj() { return(*dobj); }
|
---|
130 |
|
---|
131 | protected :
|
---|
132 |
|
---|
133 | virtual void ReadSelf(PInPersist&);
|
---|
134 | virtual void WriteSelf(POutPersist&) const;
|
---|
135 | SphereThetaPhi<T>* dobj;
|
---|
136 | bool ownobj;
|
---|
137 | };
|
---|
138 |
|
---|
139 | #endif
|
---|