source: Sophya/trunk/SophyaLib/Samba/spheregorski.h@ 487

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

suppression de sorties inutiles 21-OCT-99 GLM

File size: 3.9 KB
RevLine 
[228]1#ifndef SPHEREGORSKI_SEEN
2#define SPHEREGORSKI_SEEN
3
4#include "sphericalmap.h"
[470]5#include "tvector.h"
6#include "ndatablock.h"
[228]7
[470]8#include "anydataobj.h"
9#include "ppersist.h"
10
[228]11
[470]12// ***************** CLASSE SphereGorski *****************************
13
14template<class T>
15class SphereGorski : public SphericalMap<T>, public AnyDataObj
16{
17
[228]18public :
19
20SphereGorski();
[473]21SphereGorski(int m);
[470]22SphereGorski(const SphereGorski<T>& s);
[228]23virtual ~SphereGorski();
24
25// ------------------ Definition of PixelMap abstract methods
26
[470]27/* Nombre de pixels du decoupage */
[473]28virtual int NbPixels() const;
29inline void setNbPixels(int n) {nPix_= n;}
[228]30
[470]31/* Valeur du contenu du pixel d'indice "RING" k */
[473]32virtual T& PixVal(int k);
33virtual T const& PixVal(int k) const;
[228]34
[470]35/* Nombre de tranches en theta */
[473]36int NbThetaSlices() const;
37void GetThetaSlice(int index,double& theta,TVector<double>& phi,TVector<T>& value) const;
[228]38
39/* Indice "RING" du pixel vers lequel pointe une direction definie par
40ses coordonnees spheriques */
[473]41virtual int PixIndexSph(double theta,double phi) const;
[228]42
[470]43/* Coordonnees spheriques du milieu du pixel d'indice "RING" k */
[473]44virtual void PixThetaPhi(int k,double& theta,double& phi) const;
[228]45
[470]46/* Pixel Solid angle (steradians) */
[473]47virtual double PixSolAngle(int dummy) const;
48inline void setPixSolAngle(double x) {omeg_= x;}
[228]49
50// --------------- Specific methods
51
[473]52virtual void Resize(int m);
[470]53
54inline virtual char* TypeOfMap() const {return "RING";};
55
[473]56/* Valeur du contenu du pixel d'indice "NEST" k */
57virtual T& PixValNest(int k);
58virtual T const& PixValNest(int k) const;
[228]59
60/* Indice "NEST" du pixel vers lequel pointe une direction definie par
61ses coordonnees spheriques */
[473]62virtual int PixIndexSphNest(double theta,double phi) const;
[228]63
64/* Coordonnees spheriques du milieu du pixel d'indice "NEST" k */
[473]65virtual void PixThetaPhiNest(int k,double& theta,double& phi) const;
[228]66
[470]67/* algorithme de pixelisation */
[473]68void Pixelize(int);
[228]69
70/* convertit index nested en ring */
[473]71int NestToRing(int) const;
[228]72
73/* convertit index ring en nested" */
[473]74int RingToNest(int) const;
[228]75
76
[470]77/* retourne/fixe la valeur du parametre Gorski */
[473]78inline virtual int SizeIndex() const {return(nSide_);}
79inline void setSizeIndex(int n) {nSide_= n;}
[228]80
[470]81/* retourne les pointeurs /remplit les tableaux */
82inline const NDataBlock<T>* getDataBlock() const { return (&pixels_); }
[473]83inline void setDataBlock(T* data,int m) { pixels_.FillFrom(m,data); }
[470]84
85
86
87/* impression */
88void print(ostream& os) const;
89
[228]90private :
91
[470]92// ------------- méthodes internes ----------------------
93void InitNul();
94
[473]95int nest2ring(int nside,int ipnest) const;
96int ring2nest(int nside,int ipring) const;
[470]97
[473]98int ang2pix_ring(int nside,double theta,double phi) const;
99int ang2pix_nest(int nside,double theta,double phi) const;
100void pix2ang_ring(int nside,int ipix,double& theta,double& phi) const;
101void pix2ang_nest(int nside,int ipix,double& theta,double& phi) const;
[470]102
[228]103// ------------- variables internes -----------------------
[473]104int nSide_;
105int nPix_;
106double omeg_;
[228]107
[470]108NDataBlock<T> pixels_;
[228]109
110};
[470]111
112//
113// ------------- Classe pour la gestion de persistance --
114//
115template <class T>
116class FIO_SphereGorski : public PPersist
117{
118public:
119
120FIO_SphereGorski();
121FIO_SphereGorski(string const & filename);
122FIO_SphereGorski(const SphereGorski<T>& obj);
123FIO_SphereGorski(SphereGorski<T>* obj);
124virtual ~FIO_SphereGorski();
125virtual AnyDataObj* DataObj();
126inline operator SphereGorski<T>() { return(*dobj); }
127inline SphereGorski<T> getObj() { return(*dobj); }
128
129protected :
130
131virtual void ReadSelf(PInPersist&);
132virtual void WriteSelf(POutPersist&) const;
133SphereGorski<T>* dobj;
134bool ownobj;
135};
136
137//
138// ------------- Classe PIXELS_XY -----------------------
139//
140class PIXELS_XY
141{
142
143public :
144
145static PIXELS_XY& instance();
146
147NDataBlock<int> pix2x_;
148NDataBlock<int> pix2y_;
149NDataBlock<int> x2pix_;
150NDataBlock<int> y2pix_;
151
152private :
153
154PIXELS_XY();
155void mk_pix2xy();
156void mk_xy2pix();
157};
[228]158#endif
Note: See TracBrowser for help on using the repository browser.