#ifndef SPHERETHETAPHI_SEEN #define SPHERETHETAPHI_SEEN #include "sphericalmap.h" #include "ndatablock.h" #include "tvector.h" #include "anydataobj.h" #include "ppersist.h" // ***************** Class SphereThetaPhi ***************************** template class SphereThetaPhi : public SphericalMap, public AnyDataObj { public : SphereThetaPhi(); SphereThetaPhi(int m); SphereThetaPhi(const SphereThetaPhi& s); virtual ~SphereThetaPhi(); // ------------ Definition of PixelMap abstract methods - /* retourne/fixe le nombre de pixels */ virtual int NbPixels() const; inline void setNbPixels(int nbpix) { NPix_= nbpix; } /* retourne la valeur du pixel d'indice k */ virtual T& PixVal(int k); virtual T const& PixVal(int k) const; /* Return true if teta,phi in map */ virtual bool ContainsSph(double theta, double phi) const; /* retourne l'indice du pixel a (theta,phi) */ virtual int PixIndexSph(double theta, double phi) const; /* retourne les coordonnees Spheriques du centre du pixel d'indice k */ virtual void PixThetaPhi(int k, double& theta, double& phi) const; /* retourne/fixe l'angle Solide de Pixel (steradians) */ virtual double PixSolAngle(int dummy) const; inline void setPixSolAngle(double omega) { Omega_= omega; } /* retourne/fixe la valeur du parametre de decoupage m */ inline virtual int SizeIndex() const { return( NTheta_); } inline void setSizeIndex(int nbindex) { NTheta_= nbindex; } // ------------- Specific methods ---------------------- virtual void Resize(int m); inline virtual char* TypeOfMap() const {return "TETAFI";}; /* Valeurs de theta des paralleles et phi des meridiens limitant le pixel d'indice k */ virtual void Limits(int k,double& th1,double& th2,double& phi1,double& phi2); /* Nombre de tranches en theta */ int NbThetaSlices() const; /* Nombre de pixels en phi de la tranche d'indice kt */ int NPhi(int kt) const; /* Renvoie dans t1,t2 les valeurs respectives de theta min et theta max */ /* de la tranche d'indice kt */ void Theta(int kt, double& t1, double& t2); /* Renvoie dans p1,p2 les valeurs phimin et phimax du pixel d'indice jp */ /* dans la tranche d'indice kt */ void Phi(int kt, int jp, double& p1, double& p2); /* Renvoie l'indice k du pixel d'indice jp dans la tranche d'indice kt */ int Index(int kt, int jp) const; /* Indice kt de la tranche et indice jp du pixel d'indice k */ void ThetaPhiIndex(int k,int& kt,int& jp); void Pixelize(int); void GetThetaSlice(int index,double& theta,TVector& phi,TVector& value) const; /*retourne le tableau contenant le nombre de pixels en phi de chacune des bandes en theta */ inline const int* getmNPhi() const { return(NPhi_); } void setmNPhi(int* array, int m); /* retourne/remplit le tableau contenant le nombre/Deuxpi total des pixels contenus dans les bandes */ inline const int* getmTNphi() const { return(TNphi_); } void setmTNphi(int* array, int m); /* retourne/remplit le tableau contenant les valeurs limites de theta */ inline const double* getmTheta() const { return(Theta_); } void setmTheta(double* array, int m); /* retourne le pointeur vers/remplit le vecteur des contenus des pixels */ inline const NDataBlock* getDataBlock() const { return (&pixels_); } void setDataBlock(T* data, int m); /* impression */ void print(ostream& os) const; private : // ------------- méthodes internes ---------------------- void InitNul(); void Clear(); // ------------- variables internes --------------------- int NTheta_; int NPix_; double Omega_; int* NPhi_; int* TNphi_; double* Theta_; NDataBlock pixels_; }; // ------------- Classe pour la gestion de persistance -- template class FIO_SphereThetaPhi : public PPersist { public: FIO_SphereThetaPhi(); FIO_SphereThetaPhi(string const & filename); FIO_SphereThetaPhi(const SphereThetaPhi& obj); FIO_SphereThetaPhi(SphereThetaPhi* obj); virtual ~FIO_SphereThetaPhi(); virtual AnyDataObj* DataObj(); inline operator SphereThetaPhi() { return(*dobj); } inline SphereThetaPhi getObj() { return(*dobj); } protected : virtual void ReadSelf(PInPersist&); virtual void WriteSelf(POutPersist&) const; SphereThetaPhi* dobj; bool ownobj; }; #endif