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