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