source: Sophya/trunk/SophyaLib/Samba/spherethetaphi.h@ 471

Last change on this file since 471 was 470, checked in by ansari, 26 years ago

versions templatees, NdataBlocks etc. 15-OCT-99-GLM

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