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
RevLine 
[228]1#ifndef SPHEREGORSKI_SEEN
2#define SPHEREGORSKI_SEEN
3
4#include "sphericalmap.h"
[470]5#include "tvector.h"
6#include "ndatablock.h"
[228]7
[470]8#include "anydataobj.h"
9#include "ppersist.h"
10
[228]11
[470]12// ***************** CLASSE SphereGorski *****************************
13
14template<class T>
15class SphereGorski : public SphericalMap<T>, public AnyDataObj
16{
17
[228]18public :
19
20SphereGorski();
[473]21SphereGorski(int m);
[470]22SphereGorski(const SphereGorski<T>& s);
[228]23virtual ~SphereGorski();
24
25// ------------------ Definition of PixelMap abstract methods
26
[470]27/* Nombre de pixels du decoupage */
[473]28virtual int NbPixels() const;
29inline void setNbPixels(int n) {nPix_= n;}
[228]30
[470]31/* Valeur du contenu du pixel d'indice "RING" k */
[473]32virtual T& PixVal(int k);
33virtual T const& PixVal(int k) const;
[228]34
[470]35/* Nombre de tranches en theta */
[473]36int NbThetaSlices() const;
37void GetThetaSlice(int index,double& theta,TVector<double>& phi,TVector<T>& value) const;
[228]38
[518]39/* Return true if teta,phi in map */
40virtual bool ContainsSph(double theta, double phi) const;
[228]41/* Indice "RING" du pixel vers lequel pointe une direction definie par
42ses coordonnees spheriques */
[473]43virtual int PixIndexSph(double theta,double phi) const;
[228]44
[470]45/* Coordonnees spheriques du milieu du pixel d'indice "RING" k */
[473]46virtual void PixThetaPhi(int k,double& theta,double& phi) const;
[228]47
[470]48/* Pixel Solid angle (steradians) */
[473]49virtual double PixSolAngle(int dummy) const;
50inline void setPixSolAngle(double x) {omeg_= x;}
[228]51
52// --------------- Specific methods
53
[473]54virtual void Resize(int m);
[470]55
56inline virtual char* TypeOfMap() const {return "RING";};
57
[473]58/* Valeur du contenu du pixel d'indice "NEST" k */
59virtual T& PixValNest(int k);
60virtual T const& PixValNest(int k) const;
[228]61
62/* Indice "NEST" du pixel vers lequel pointe une direction definie par
63ses coordonnees spheriques */
[473]64virtual int PixIndexSphNest(double theta,double phi) const;
[228]65
66/* Coordonnees spheriques du milieu du pixel d'indice "NEST" k */
[473]67virtual void PixThetaPhiNest(int k,double& theta,double& phi) const;
[228]68
[470]69/* algorithme de pixelisation */
[473]70void Pixelize(int);
[228]71
72/* convertit index nested en ring */
[473]73int NestToRing(int) const;
[228]74
75/* convertit index ring en nested" */
[473]76int RingToNest(int) const;
[228]77
78
[470]79/* retourne/fixe la valeur du parametre Gorski */
[473]80inline virtual int SizeIndex() const {return(nSide_);}
81inline void setSizeIndex(int n) {nSide_= n;}
[228]82
[470]83/* retourne les pointeurs /remplit les tableaux */
84inline const NDataBlock<T>* getDataBlock() const { return (&pixels_); }
[473]85inline void setDataBlock(T* data,int m) { pixels_.FillFrom(m,data); }
[470]86
87
88
89/* impression */
90void print(ostream& os) const;
91
[228]92private :
93
[470]94// ------------- méthodes internes ----------------------
95void InitNul();
96
[473]97int nest2ring(int nside,int ipnest) const;
98int ring2nest(int nside,int ipring) const;
[470]99
[473]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;
[470]104
[228]105// ------------- variables internes -----------------------
[473]106int nSide_;
107int nPix_;
108double omeg_;
[228]109
[470]110NDataBlock<T> pixels_;
[228]111
112};
[470]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};
[228]160#endif
Note: See TracBrowser for help on using the repository browser.