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