| [1371] | 1 | //   Class for managing sky scanning | 
|---|
|  | 2 | //        R. Ansari , G. Le Meur   1998-2000 | 
|---|
|  | 3 | // DAPNIA/SPP (Saclay) / CEA    LAL - IN2P3/CNRS  (Orsay) | 
|---|
|  | 4 |  | 
|---|
| [228] | 5 | #ifndef SCAN_H_SEEN | 
|---|
|  | 6 | #define SCAN_H_SEEN | 
|---|
|  | 7 |  | 
|---|
|  | 8 |  | 
|---|
|  | 9 | #include "ppersist.h" | 
|---|
| [2322] | 10 | #include <iostream> | 
|---|
| [228] | 11 | #include "dvlist.h" | 
|---|
| [565] | 12 | #include "ndatablock.h" | 
|---|
| [701] | 13 |  | 
|---|
| [1371] | 14 | namespace SOPHYA { | 
|---|
|  | 15 |  | 
|---|
| [701] | 16 | class FIO_Scan; | 
|---|
|  | 17 |  | 
|---|
| [565] | 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) | 
|---|
| [228] | 19 |  | 
|---|
| [565] | 20 | class Scan :  public AnyDataObj  { | 
|---|
| [701] | 21 | friend class FIO_Scan; | 
|---|
| [228] | 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 | */ | 
|---|
| [565] | 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 | */ | 
|---|
| [228] | 47 | Scan(float,float*,float,float,float,float); | 
|---|
| [701] | 48 | Scan(const Scan&,  bool share=false ); | 
|---|
| [228] | 49 | Scan() { | 
|---|
|  | 50 | InitNull(); | 
|---|
|  | 51 | } | 
|---|
|  | 52 | ~Scan(); | 
|---|
|  | 53 |  | 
|---|
|  | 54 | // ------------ Persistence handling | 
|---|
|  | 55 |  | 
|---|
| [565] | 56 | //     enum {classId = 0xF003 }; | 
|---|
|  | 57 | //int_4                  ClassId() const        { return classId; } | 
|---|
| [228] | 58 |  | 
|---|
| [565] | 59 | //virtual void           WriteSelf(POutPersist&) const; | 
|---|
|  | 60 | //virtual void           ReadSelf(PInPersist&); | 
|---|
| [228] | 61 |  | 
|---|
| [565] | 62 | /*!   Return the number of points in the scan */ | 
|---|
| [228] | 63 | int_4     NbPoints() const; | 
|---|
| [565] | 64 | /*!    Return total nomber of turns */ | 
|---|
| [228] | 65 | int_4     NbTours() const; | 
|---|
| [565] | 66 | /*!    Return  nomber of points for 1 turn */ | 
|---|
| [228] | 67 | int_4     NbPts1Tr() const; | 
|---|
| [565] | 68 | /*!    Return index of pixel associated to time t */ | 
|---|
| [228] | 69 | int_4     ValueIndex(float) const; | 
|---|
| [565] | 70 | /*!    Return  (teta,phi) coordinate of pixel related to time t */ | 
|---|
| [228] | 71 | void    Direction(float, float& ,float& ); | 
|---|
| [565] | 72 | /*!    Return  (teta,phi) coordinates of  pixel with index k */ | 
|---|
| [228] | 73 | void    DirectionIndex(int_4,float& ,float& ); | 
|---|
| [565] | 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; | 
|---|
| [228] | 78 |  | 
|---|
|  | 79 | /* Surcharge de la parenthese a un indice entier : remplit ou/et renvoie */ | 
|---|
|  | 80 | /* la valeur du contenu du pixel d'indice k                              */ | 
|---|
| [565] | 81 |  | 
|---|
|  | 82 | inline  r_8&    operator()(int_4 k) | 
|---|
| [228] | 83 | { return(PixelValue(k)) ; } ; | 
|---|
| [565] | 84 | inline  r_8 const &    operator()(int_4 k) const | 
|---|
|  | 85 | { return(PixelValue(k)) ; } ; | 
|---|
|  | 86 | Scan& operator = (const Scan& s); | 
|---|
| [228] | 87 | //++ | 
|---|
|  | 88 | DVList&  Info() | 
|---|
|  | 89 | // | 
|---|
|  | 90 | //      Renvoie une reference sur l'objet DVList Associe | 
|---|
|  | 91 | //-- | 
|---|
| [565] | 92 | { | 
|---|
| [228] | 93 | if (mInfo_ == NULL)  mInfo_ = new DVList; | 
|---|
|  | 94 | return(*mInfo_); | 
|---|
|  | 95 | } | 
|---|
|  | 96 |  | 
|---|
| [565] | 97 | const DVList*  ptrInfo() const | 
|---|
|  | 98 | { | 
|---|
|  | 99 | return mInfo_; | 
|---|
|  | 100 | } | 
|---|
| [228] | 101 |  | 
|---|
| [565] | 102 |  | 
|---|
|  | 103 |  | 
|---|
| [701] | 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 |  | 
|---|
| [565] | 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] */ | 
|---|
| [228] | 166 | /* Xs : coordonnees dans un systeme lie au satellite*/ | 
|---|
|  | 167 | /* Xf : coordonnees dans un repere "fixe"           */ | 
|---|
| [565] | 168 | DVList* mInfo_;        // Infos (variables) attachees | 
|---|
| [228] | 169 | }; | 
|---|
|  | 170 |  | 
|---|
| [565] | 171 | // ------------- Classe pour la gestion de persistance -- | 
|---|
|  | 172 | //!    Delegated objects for persitance management | 
|---|
| [228] | 173 |  | 
|---|
| [565] | 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 |  | 
|---|
| [1371] | 195 | } // namespace SOPHYA | 
|---|
| [565] | 196 |  | 
|---|
| [228] | 197 | #endif /* SCAN_H_SEEN */ | 
|---|