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