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