source: Sophya/trunk/SophyaLib/Samba/spheregorski.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.0 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/* Return true if teta,phi in map */
40virtual bool ContainsSph(double theta, double phi) const;
41/* Indice "RING" du pixel vers lequel pointe une direction definie par
42ses coordonnees spheriques */
43virtual int PixIndexSph(double theta,double phi) const;
44
45/* Coordonnees spheriques du milieu du pixel d'indice "RING" k */
46virtual void PixThetaPhi(int k,double& theta,double& phi) const;
47
48/* Pixel Solid angle (steradians) */
49virtual double PixSolAngle(int dummy) const;
50inline void setPixSolAngle(double x) {omeg_= x;}
51
52// --------------- Specific methods
53
54virtual void Resize(int m);
55
56inline virtual char* TypeOfMap() const {return "RING";};
57
58/* Valeur du contenu du pixel d'indice "NEST" k */
59virtual T& PixValNest(int k);
60virtual T const& PixValNest(int k) const;
61
62/* Indice "NEST" du pixel vers lequel pointe une direction definie par
63ses coordonnees spheriques */
64virtual int PixIndexSphNest(double theta,double phi) const;
65
66/* Coordonnees spheriques du milieu du pixel d'indice "NEST" k */
67virtual void PixThetaPhiNest(int k,double& theta,double& phi) const;
68
69/* algorithme de pixelisation */
70void Pixelize(int);
71
72/* convertit index nested en ring */
73int NestToRing(int) const;
74
75/* convertit index ring en nested" */
76int RingToNest(int) const;
77
78
79/* retourne/fixe la valeur du parametre Gorski */
80inline virtual int SizeIndex() const {return(nSide_);}
81inline void setSizeIndex(int n) {nSide_= n;}
82
83/* retourne les pointeurs /remplit les tableaux */
84inline const NDataBlock<T>* getDataBlock() const { return (&pixels_); }
85inline void setDataBlock(T* data,int m) { pixels_.FillFrom(m,data); }
86
87
88
89/* impression */
90void print(ostream& os) const;
91
92private :
93
94// ------------- méthodes internes ----------------------
95void InitNul();
96
97int nest2ring(int nside,int ipnest) const;
98int ring2nest(int nside,int ipring) const;
99
100int ang2pix_ring(int nside,double theta,double phi) const;
101int ang2pix_nest(int nside,double theta,double phi) const;
102void pix2ang_ring(int nside,int ipix,double& theta,double& phi) const;
103void pix2ang_nest(int nside,int ipix,double& theta,double& phi) const;
104
105// ------------- variables internes -----------------------
106int nSide_;
107int nPix_;
108double omeg_;
109
110NDataBlock<T> pixels_;
111
112};
113
114//
115// ------------- Classe pour la gestion de persistance --
116//
117template <class T>
118class FIO_SphereGorski : public PPersist
119{
120public:
121
122FIO_SphereGorski();
123FIO_SphereGorski(string const & filename);
124FIO_SphereGorski(const SphereGorski<T>& obj);
125FIO_SphereGorski(SphereGorski<T>* obj);
126virtual ~FIO_SphereGorski();
127virtual AnyDataObj* DataObj();
128inline operator SphereGorski<T>() { return(*dobj); }
129inline SphereGorski<T> getObj() { return(*dobj); }
130
131protected :
132
133virtual void ReadSelf(PInPersist&);
134virtual void WriteSelf(POutPersist&) const;
135SphereGorski<T>* dobj;
136bool ownobj;
137};
138
139//
140// ------------- Classe PIXELS_XY -----------------------
141//
142class PIXELS_XY
143{
144
145public :
146
147static PIXELS_XY& instance();
148
149NDataBlock<int> pix2x_;
150NDataBlock<int> pix2y_;
151NDataBlock<int> x2pix_;
152NDataBlock<int> y2pix_;
153
154private :
155
156PIXELS_XY();
157void mk_pix2xy();
158void mk_xy2pix();
159};
160#endif
Note: See TracBrowser for help on using the repository browser.