source: Sophya/trunk/SophyaLib/Samba/spherethetaphi.h@ 478

Last change on this file since 478 was 473, checked in by ansari, 26 years ago

modifs francois : passage en double etc. 18-OCT-99

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