Ignore:
Timestamp:
Oct 15, 1999, 5:43:30 PM (26 years ago)
Author:
ansari
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/Samba/spherethetaphi.h

    r228 r470  
    33
    44#include "sphericalmap.h"
    5 #include "pdataarray.h"
    6 #include "cvector.h"
     5#include "ndatablock.h"
     6#include "tvector.h"
    77
    8 // ***************** CLASSE SphereThetaPhi *****************************
     8#include "anydataobj.h"
     9#include "ppersist.h"
    910
     11// ***************** Class SphereThetaPhi *****************************
    1012
    11 class SphereThetaPhi : public SphericalMap {
     13template <class T>
     14class SphereThetaPhi : public SphericalMap<T>, public AnyDataObj
     15{
     16
    1217public :
    1318
    14 
    15 SphereThetaPhi(int_4 m, int_4 pet);
    1619SphereThetaPhi();
     20SphereThetaPhi(int_4 m);
    1721SphereThetaPhi(char* flnm);
     22SphereThetaPhi(const SphereThetaPhi<T>& s);
    1823virtual ~SphereThetaPhi();
    1924
    20 // ------------ Persistence handling
     25// ------------ Definition of PixelMap abstract methods -
    2126
    22      enum {classId = 0xF001 };
    23 int_4                  ClassId() const        { return classId; }
     27/* retourne/fixe le nombre de pixels */
     28virtual int_4 NbPixels() const;
     29inline void setNbPixels(int_4 nbpix) { NPix_= nbpix; }
    2430
    25 virtual void           WriteSelf(POutPersist&) const;
    26 virtual void           ReadSelf(PInPersist&);
     31/* retourne la valeur du pixel d'indice k */
     32virtual T&       PixVal(int_4 k);
     33virtual T const& PixVal(int_4 k) const;
    2734
    28 // ------------------ Definition of PixelMap abstract methods
     35/* retourne l'indice du pixel a (theta,phi) */
     36virtual int_4 PixIndexSph(float theta, float phi) const;
    2937
    30 // number of pixels
    31 virtual  int_4           NbPixels() const;
     38/* retourne les coordonnees Spheriques du centre du pixel d'indice k */
     39virtual void PixThetaPhi(int_4 k, float& theta, float& phi) const;
    3240
    33 // Value of pixel number k
    34 virtual  r_8&       PixVal(int_4 k);
    35 virtual  r_8 const&       PixVal(int_4 k) const;
     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; }
    3648
    37 // Index of pixel at (theta,phi)
    38 virtual  int_4           PixIndexSph(float theta, float phi) const;
     49// ------------- Specific methods  ----------------------
    3950
    40 // Spherical coordinates of center of pixel number k
    41 virtual  void          PixThetaPhi(int_4 k, float& theta, float& phi) const;
     51virtual void Resize(int_4 m);
    4252
    43 // Pixel Solid angle  (steradians)
    44 virtual r_8         PixSolAngle(int_4 dummy) const;
    45 // --------------- Specific methods
     53inline virtual char* TypeOfMap() const {return "TETAFI";};
    4654
     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);
    4757
    48 /* Valeurs de theta des paralleles et phi des meridiens limitant          */
    49 /* le pixel d'indice k                                                   */
    50 virtual  void          Limits(int_4 k, float& tet1, float& tet2,
    51                                 float& phi1, float& phi2 );
     58/* Nombre de tranches en theta */
     59int_4 NbThetaSlices() const;
    5260
    53 /* Nombre de tranches en theta                                           */
    54 int_4           NbThetaSlices() const;
    55 
    56 /* Nombre de pixels en phi de la tranche d'indice kt                     */
    57 int_4           NPhi(int_4 kt) const;
     61/* Nombre de pixels en phi de la tranche d'indice kt */
     62int_4 NPhi(int_4 kt) const;
    5863
    5964/* Renvoie dans t1,t2 les valeurs respectives de theta min et theta max  */
    60 /* de la tranche d'indice kt                                             */
    61 void          Theta(int_4 kt, float& t1, float& t2);
     65/* de la tranche d'indice kt  */
     66void Theta(int_4 kt, float& t1, float& t2);
    6267
    6368/* Renvoie dans p1,p2 les valeurs phimin et phimax du pixel d'indice jp  */
    64 /* dans la tranche d'indice kt                                           */
    65 void          Phi(int_4 kt, int_4 jp, float& p1, float& p2);
     69/* dans la tranche d'indice kt  */
     70void Phi(int_4 kt, int_4 jp, float& p1, float& p2);
    6671
    6772/* Renvoie l'indice k du pixel d'indice jp dans la tranche d'indice kt   */
    68 int_4           Index(int_4 kt, int_4 jp) const;
     73int_4 Index(int_4 kt, int_4 jp) const;
    6974
     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);
    7077
    71 /* Indice kt de la tranche et indice jp du pixel d'indice k            */
    72 void          ThetaPhiIndex(int_4 k,int_4& kt,int_4& jp);
     78void Pixelize(int_4);
    7379
    74 void Pixelize(int_4,int_4);
    75 void GetThetaSlice(int_4 index, r_4& theta, Vector& phi, Vector& value) const;
     80void GetThetaSlice(int_4 index,r_4& theta,TVector<float>& phi,TVector<T>& value) const;
    7681
     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);
     85
     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);
     89
     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);
     93
     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);
     97
     98/* impression */
     99void print(ostream& os) const;
    77100
    78101private :
    79 // ------------- méthodes internes ----------------------
    80          
    81102
    82 void          InitNul();
    83 void          Clear();
     103// ------------- méthodes internes ----------------------         
     104void InitNul();
     105void Clear();
    84106
    85 // ------------- variables internes -----------------------
    86 int_4 mNTheta,mNPet;
    87 int_4 mNPix;
    88 r_4* mTheta;
    89 r_8  mOmeg;
    90 int_4* mNphi;
    91 int_4* mTNphi;
    92 //r_8* mPix;
    93 PDataArray<r_8>* _pixel;
    94 
    95 
     107// ------------- variables internes ---------------------
     108int_4 NTheta_;
     109int_4 NPix_;
     110r_8 Omega_;
     111int_4* NPhi_;
     112int_4* TNphi_;
     113r_4* Theta_;
     114NDataBlock<T> pixels_;
    96115};
    97116
     117// ------------- Classe pour la gestion de persistance --
     118template <class T>
     119class FIO_SphereThetaPhi : public PPersist 
     120{
     121public:
    98122
     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); }
     131
     132protected :
     133
     134virtual void ReadSelf(PInPersist&);           
     135virtual void WriteSelf(POutPersist&) const; 
     136SphereThetaPhi<T>* dobj;
     137bool ownobj;
     138};
    99139
    100140#endif
Note: See TracChangeset for help on using the changeset viewer.