| 1 | //   Class for managing sky scanning | 
|---|
| 2 | //        R. Ansari , G. Le Meur   1998-2000 | 
|---|
| 3 | // DAPNIA/SPP (Saclay) / CEA    LAL - IN2P3/CNRS  (Orsay) | 
|---|
| 4 |  | 
|---|
| 5 | #ifndef SCAN_H_SEEN | 
|---|
| 6 | #define SCAN_H_SEEN | 
|---|
| 7 |  | 
|---|
| 8 |  | 
|---|
| 9 | #include "ppersist.h" | 
|---|
| 10 | #include <iostream.h> | 
|---|
| 11 | #include "dvlist.h" | 
|---|
| 12 | #include "ndatablock.h" | 
|---|
| 13 |  | 
|---|
| 14 | namespace SOPHYA { | 
|---|
| 15 |  | 
|---|
| 16 | class FIO_Scan; | 
|---|
| 17 |  | 
|---|
| 18 | //!   Storage and treatment of data for a scanning of a part of the sky with a set of given values for parameters (see constructor) | 
|---|
| 19 |  | 
|---|
| 20 | class Scan :  public AnyDataObj  { | 
|---|
| 21 | friend class FIO_Scan; | 
|---|
| 22 | public  : | 
|---|
| 23 | /* | 
|---|
| 24 | arguments du constructeur : | 
|---|
| 25 | . ouverture (radians), | 
|---|
| 26 | . un tableau de 3 reels (deux angles-en radians- definissant la direction de | 
|---|
| 27 | l'axe de rotation du satellite + vitesse de rotation | 
|---|
| 28 | en radians/s), | 
|---|
| 29 | . frequence d'echantillonnage (Hz), | 
|---|
| 30 | . instant final de prise de donnees (s), | 
|---|
| 31 | deux arguments optionnels : | 
|---|
| 32 | . instant initial pour la prise de donnees | 
|---|
| 33 | . offset d'antenne en angle phi | 
|---|
| 34 | */ | 
|---|
| 35 |  | 
|---|
| 36 | /*! | 
|---|
| 37 | \verbatim | 
|---|
| 38 | * Ouv      = aperture angle (rad) | 
|---|
| 39 | * Omega[3] = direction of rotation axis of the satellite (teta,phi) | 
|---|
| 40 | and rotation velocity (rad/s) | 
|---|
| 41 | * Fech     = sampling frequency  (Hz) | 
|---|
| 42 | * T        = total time of data acquistion (s) | 
|---|
| 43 | * t0       = starting time (s) | 
|---|
| 44 | * phi0     = offset of antenna (rad) | 
|---|
| 45 | \endverbatim | 
|---|
| 46 | */ | 
|---|
| 47 | Scan(float,float*,float,float,float,float); | 
|---|
| 48 | Scan(const Scan&,  bool share=false ); | 
|---|
| 49 | Scan() { | 
|---|
| 50 | InitNull(); | 
|---|
| 51 | } | 
|---|
| 52 | ~Scan(); | 
|---|
| 53 |  | 
|---|
| 54 | // ------------ Persistence handling | 
|---|
| 55 |  | 
|---|
| 56 | //     enum {classId = 0xF003 }; | 
|---|
| 57 | //int_4                  ClassId() const        { return classId; } | 
|---|
| 58 |  | 
|---|
| 59 | //virtual void           WriteSelf(POutPersist&) const; | 
|---|
| 60 | //virtual void           ReadSelf(PInPersist&); | 
|---|
| 61 |  | 
|---|
| 62 | /*!   Return the number of points in the scan */ | 
|---|
| 63 | int_4     NbPoints() const; | 
|---|
| 64 | /*!    Return total nomber of turns */ | 
|---|
| 65 | int_4     NbTours() const; | 
|---|
| 66 | /*!    Return  nomber of points for 1 turn */ | 
|---|
| 67 | int_4     NbPts1Tr() const; | 
|---|
| 68 | /*!    Return index of pixel associated to time t */ | 
|---|
| 69 | int_4     ValueIndex(float) const; | 
|---|
| 70 | /*!    Return  (teta,phi) coordinate of pixel related to time t */ | 
|---|
| 71 | void    Direction(float, float& ,float& ); | 
|---|
| 72 | /*!    Return  (teta,phi) coordinates of  pixel with index k */ | 
|---|
| 73 | void    DirectionIndex(int_4,float& ,float& ); | 
|---|
| 74 | /*!    Return value of pixel with index k */ | 
|---|
| 75 | r_8  & PixelValue(int_4 k) ; | 
|---|
| 76 | /*!    const version of previous method */ | 
|---|
| 77 | r_8 const & PixelValue(int_4 k) const; | 
|---|
| 78 |  | 
|---|
| 79 | /* Surcharge de la parenthese a un indice entier : remplit ou/et renvoie */ | 
|---|
| 80 | /* la valeur du contenu du pixel d'indice k                              */ | 
|---|
| 81 |  | 
|---|
| 82 | inline  r_8&    operator()(int_4 k) | 
|---|
| 83 | { return(PixelValue(k)) ; } ; | 
|---|
| 84 | inline  r_8 const &    operator()(int_4 k) const | 
|---|
| 85 | { return(PixelValue(k)) ; } ; | 
|---|
| 86 | Scan& operator = (const Scan& s); | 
|---|
| 87 | //++ | 
|---|
| 88 | DVList&  Info() | 
|---|
| 89 | // | 
|---|
| 90 | //      Renvoie une reference sur l'objet DVList Associe | 
|---|
| 91 | //-- | 
|---|
| 92 | { | 
|---|
| 93 | if (mInfo_ == NULL)  mInfo_ = new DVList; | 
|---|
| 94 | return(*mInfo_); | 
|---|
| 95 | } | 
|---|
| 96 |  | 
|---|
| 97 | const DVList*  ptrInfo() const | 
|---|
| 98 | { | 
|---|
| 99 | return mInfo_; | 
|---|
| 100 | } | 
|---|
| 101 |  | 
|---|
| 102 |  | 
|---|
| 103 |  | 
|---|
| 104 |  | 
|---|
| 105 |  | 
|---|
| 106 | private : | 
|---|
| 107 |  | 
|---|
| 108 | //void          Clear(); | 
|---|
| 109 | void          InitNull(); | 
|---|
| 110 |  | 
|---|
| 111 | /*  Acces to the DataBlock  */ | 
|---|
| 112 | inline       NDataBlock<r_8>& DataBlock()       {return sPix_;} | 
|---|
| 113 | inline const NDataBlock<r_8>& DataBlock() const {return sPix_;} | 
|---|
| 114 |  | 
|---|
| 115 | inline  void  SetIntParams(int_4 NmaxPts, int_4 NmaxTrs, int_4 NPts1Tr) | 
|---|
| 116 | { | 
|---|
| 117 | NmaxPts_=NmaxPts; | 
|---|
| 118 | NmaxTrs_=NmaxTrs; | 
|---|
| 119 | NPts1Tr_=NPts1Tr; | 
|---|
| 120 | } | 
|---|
| 121 | inline void SetFloatParams(r_4 Ouverture, r_4 OmegaTeta, r_4 OmegaPhi, | 
|---|
| 122 | r_4 OmegaRad, r_4 FrequenceEch, r_4 TempsFinal, | 
|---|
| 123 | r_4 TempsInitial, r_4 PhiZero, r_8* Rota) | 
|---|
| 124 | { | 
|---|
| 125 | Ouverture_    = Ouverture; | 
|---|
| 126 | OmegaTeta_    = OmegaTeta; | 
|---|
| 127 | OmegaPhi_     = OmegaPhi; | 
|---|
| 128 | OmegaRad_     = OmegaRad; | 
|---|
| 129 | FrequenceEch_ = FrequenceEch; | 
|---|
| 130 | TempsFinal_   = TempsFinal; | 
|---|
| 131 | TempsInitial_ = TempsInitial; | 
|---|
| 132 | PhiZero_      = PhiZero; | 
|---|
| 133 | for (int k=0; k<9;k++) Rota_[k]=Rota[k]; | 
|---|
| 134 | } | 
|---|
| 135 |  | 
|---|
| 136 | inline void GetFloatParams(r_4& Ouverture, r_4& OmegaTeta, r_4& OmegaPhi, | 
|---|
| 137 | r_4& OmegaRad, r_4& FrequenceEch, r_4& TempsFinal, | 
|---|
| 138 | r_4& TempsInitial, r_4& PhiZero, r_8* Rota) const | 
|---|
| 139 | { | 
|---|
| 140 | Ouverture    = Ouverture_; | 
|---|
| 141 | OmegaTeta    = OmegaTeta_; | 
|---|
| 142 | OmegaPhi     = OmegaPhi_; | 
|---|
| 143 | OmegaRad     = OmegaRad_; | 
|---|
| 144 | FrequenceEch = FrequenceEch_; | 
|---|
| 145 | TempsFinal   = TempsFinal_; | 
|---|
| 146 | TempsInitial = TempsInitial_; | 
|---|
| 147 | PhiZero      = PhiZero_; | 
|---|
| 148 | for (int k=0; k<9;k++) Rota[k]=Rota_[k]; | 
|---|
| 149 | } | 
|---|
| 150 |  | 
|---|
| 151 |  | 
|---|
| 152 | int_4 NmaxPts_; | 
|---|
| 153 | int_4 NmaxTrs_; | 
|---|
| 154 | int_4 NPts1Tr_; | 
|---|
| 155 | r_4   Ouverture_; | 
|---|
| 156 | r_4   OmegaTeta_;     /* direction de l'axe de rotation du satellite */ | 
|---|
| 157 | r_4   OmegaPhi_;      /* (radians)                                   */ | 
|---|
| 158 | r_4   OmegaRad_;      /* vitesse de rotation du satellite (radians/s) */ | 
|---|
| 159 | r_4   FrequenceEch_;  /* frequence d'echantillonnage (Hz)*/ | 
|---|
| 160 | r_4   TempsFinal_; | 
|---|
| 161 | r_4   TempsInitial_; | 
|---|
| 162 | r_4   PhiZero_;           /* Offset antenne (radians)  */ | 
|---|
| 163 | NDataBlock<r_8>  sPix_;   /* valeurs contenues dans chaque pixel */ | 
|---|
| 164 | //r_8*  sPix_;            /* valeurs contenues dans chaque pixel */ | 
|---|
| 165 | r_8   Rota_[9];       /* matrice de passage : [Xf]=[Rota][Xs] */ | 
|---|
| 166 | /* Xs : coordonnees dans un systeme lie au satellite*/ | 
|---|
| 167 | /* Xf : coordonnees dans un repere "fixe"           */ | 
|---|
| 168 | DVList* mInfo_;        // Infos (variables) attachees | 
|---|
| 169 | }; | 
|---|
| 170 |  | 
|---|
| 171 | // ------------- Classe pour la gestion de persistance -- | 
|---|
| 172 | //!    Delegated objects for persitance management | 
|---|
| 173 |  | 
|---|
| 174 | class FIO_Scan : public PPersist | 
|---|
| 175 | { | 
|---|
| 176 |  | 
|---|
| 177 | public: | 
|---|
| 178 |  | 
|---|
| 179 | FIO_Scan(); | 
|---|
| 180 | FIO_Scan(string const & filename); | 
|---|
| 181 | FIO_Scan(const Scan& obj); | 
|---|
| 182 | FIO_Scan(Scan* obj); | 
|---|
| 183 | virtual ~FIO_Scan(); | 
|---|
| 184 | virtual AnyDataObj* DataObj(); | 
|---|
| 185 | inline operator Scan() {return(*dobj); } | 
|---|
| 186 |  | 
|---|
| 187 | protected : | 
|---|
| 188 |  | 
|---|
| 189 | virtual void ReadSelf(PInPersist&); | 
|---|
| 190 | virtual void WriteSelf(POutPersist&) const; | 
|---|
| 191 | Scan* dobj; | 
|---|
| 192 | bool ownobj; | 
|---|
| 193 | }; | 
|---|
| 194 |  | 
|---|
| 195 | } // namespace SOPHYA | 
|---|
| 196 |  | 
|---|
| 197 | #endif /* SCAN_H_SEEN */ | 
|---|