source: Sophya/trunk/SophyaLib/Samba/spheregorski.h@ 487

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

suppression de sorties inutiles 21-OCT-99 GLM

File size: 3.9 KB
Line 
1#ifndef SPHEREGORSKI_SEEN
2#define SPHEREGORSKI_SEEN
3
4#include "sphericalmap.h"
5#include "tvector.h"
6#include "ndatablock.h"
7
8#include "anydataobj.h"
9#include "ppersist.h"
10
11
12// ***************** CLASSE SphereGorski *****************************
13
14template<class T>
15class SphereGorski : public SphericalMap<T>, public AnyDataObj
16{
17
18public :
19
20SphereGorski();
21SphereGorski(int m);
22SphereGorski(const SphereGorski<T>& s);
23virtual ~SphereGorski();
24
25// ------------------ Definition of PixelMap abstract methods
26
27/* Nombre de pixels du decoupage */
28virtual int NbPixels() const;
29inline void setNbPixels(int n) {nPix_= n;}
30
31/* Valeur du contenu du pixel d'indice "RING" k */
32virtual T& PixVal(int k);
33virtual T const& PixVal(int k) const;
34
35/* Nombre de tranches en theta */
36int NbThetaSlices() const;
37void GetThetaSlice(int index,double& theta,TVector<double>& phi,TVector<T>& value) const;
38
39/* Indice "RING" du pixel vers lequel pointe une direction definie par
40ses coordonnees spheriques */
41virtual int PixIndexSph(double theta,double phi) const;
42
43/* Coordonnees spheriques du milieu du pixel d'indice "RING" k */
44virtual void PixThetaPhi(int k,double& theta,double& phi) const;
45
46/* Pixel Solid angle (steradians) */
47virtual double PixSolAngle(int dummy) const;
48inline void setPixSolAngle(double x) {omeg_= x;}
49
50// --------------- Specific methods
51
52virtual void Resize(int m);
53
54inline virtual char* TypeOfMap() const {return "RING";};
55
56/* Valeur du contenu du pixel d'indice "NEST" k */
57virtual T& PixValNest(int k);
58virtual T const& PixValNest(int k) const;
59
60/* Indice "NEST" du pixel vers lequel pointe une direction definie par
61ses coordonnees spheriques */
62virtual int PixIndexSphNest(double theta,double phi) const;
63
64/* Coordonnees spheriques du milieu du pixel d'indice "NEST" k */
65virtual void PixThetaPhiNest(int k,double& theta,double& phi) const;
66
67/* algorithme de pixelisation */
68void Pixelize(int);
69
70/* convertit index nested en ring */
71int NestToRing(int) const;
72
73/* convertit index ring en nested" */
74int RingToNest(int) const;
75
76
77/* retourne/fixe la valeur du parametre Gorski */
78inline virtual int SizeIndex() const {return(nSide_);}
79inline void setSizeIndex(int n) {nSide_= n;}
80
81/* retourne les pointeurs /remplit les tableaux */
82inline const NDataBlock<T>* getDataBlock() const { return (&pixels_); }
83inline void setDataBlock(T* data,int m) { pixels_.FillFrom(m,data); }
84
85
86
87/* impression */
88void print(ostream& os) const;
89
90private :
91
92// ------------- méthodes internes ----------------------
93void InitNul();
94
95int nest2ring(int nside,int ipnest) const;
96int ring2nest(int nside,int ipring) const;
97
98int ang2pix_ring(int nside,double theta,double phi) const;
99int ang2pix_nest(int nside,double theta,double phi) const;
100void pix2ang_ring(int nside,int ipix,double& theta,double& phi) const;
101void pix2ang_nest(int nside,int ipix,double& theta,double& phi) const;
102
103// ------------- variables internes -----------------------
104int nSide_;
105int nPix_;
106double omeg_;
107
108NDataBlock<T> pixels_;
109
110};
111
112//
113// ------------- Classe pour la gestion de persistance --
114//
115template <class T>
116class FIO_SphereGorski : public PPersist
117{
118public:
119
120FIO_SphereGorski();
121FIO_SphereGorski(string const & filename);
122FIO_SphereGorski(const SphereGorski<T>& obj);
123FIO_SphereGorski(SphereGorski<T>* obj);
124virtual ~FIO_SphereGorski();
125virtual AnyDataObj* DataObj();
126inline operator SphereGorski<T>() { return(*dobj); }
127inline SphereGorski<T> getObj() { return(*dobj); }
128
129protected :
130
131virtual void ReadSelf(PInPersist&);
132virtual void WriteSelf(POutPersist&) const;
133SphereGorski<T>* dobj;
134bool ownobj;
135};
136
137//
138// ------------- Classe PIXELS_XY -----------------------
139//
140class PIXELS_XY
141{
142
143public :
144
145static PIXELS_XY& instance();
146
147NDataBlock<int> pix2x_;
148NDataBlock<int> pix2y_;
149NDataBlock<int> x2pix_;
150NDataBlock<int> y2pix_;
151
152private :
153
154PIXELS_XY();
155void mk_pix2xy();
156void mk_xy2pix();
157};
158#endif
Note: See TracBrowser for help on using the repository browser.