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

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

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