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