Changeset 567 in Sophya for trunk/SophyaLib/Samba/scan.cc
- Timestamp:
- Nov 10, 1999, 3:07:37 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Samba/scan.cc
r515 r567 5 5 6 6 #include "scan.h" 7 #include <complex> 8 #include "piocmplx.h" 7 9 8 10 // valeurs de Pi, 2*Pi, etc … … 14 16 // Class Scan 15 17 // 16 // include scan.h nbmath.h 17 // 18 // Cette classe permet de stocker et traiter les données pour un balayage 19 // d'une portion de ciel pour un jeu de valeurs fixé des paramètres précisé 20 // dans le constructeur. 21 //-- 22 //++ 23 // 24 // Links Parents 25 // 26 // 27 //-- 28 //++ 29 // 30 // Links Descendants 31 // 32 // 33 //-- 34 //++ 35 // Titre Constructeurs 18 // include scan.h dvlist.h math.h nbmath.h 19 // 20 // Storage and treatment of data for a scanning of a part of the sky 21 // with a set of given values for parameters (see constructor) 36 22 //-- 37 23 //++ … … 40 26 41 27 // 42 // * Ouv = a ngle d'ouverture (rad)43 // * Omega[3] = direction de l'axe de rotation dusatellite (teta,phi)44 // et vitesse de rotation(rad/s)45 // * Fech = fréquence d'échantillonnage(Hz)46 // * T = t emps total de prise des données(s)47 // * t0 = instant de départ(s)48 // * phi0 = offset antenne(rad)28 // * Ouv = aperture angle (rad) 29 // * Omega[3] = direction of rotation axis of the satellite (teta,phi) 30 // and rotation velocity (rad/s) 31 // * Fech = sampling frequency (Hz) 32 // * T = total time of data acquistion (s) 33 // * t0 = starting time (s) 34 // * phi0 = offset of antenna (rad) 49 35 //-- 50 36 { … … 79 65 80 66 // Creation et initialisation du vecteur des mesures aux points 81 sPix_ = new r_8[NmaxPts_]; 82 for( int_4 i=0; i<NmaxPts_; i++ ) sPix_[i]= 0.; 67 // sPix_ = new r_8[NmaxPts_]; 68 sPix_.ReSize(NmaxPts_); 69 sPix_.Reset(); 70 // for( int_4 i=0; i<NmaxPts_; i++ ) sPix_[i]= 0.; 71 for( int_4 i=0; i<NmaxPts_; i++ ) sPix_(i)= 0.; 83 72 84 73 // matrice de passage du systeme lie au satellite au systeme fixe … … 100 89 101 90 } 91 92 102 93 //++ 103 94 Scan::Scan(const Scan& s) 104 95 105 // Constructeur de copie106 //-- 107 { 108 NmaxPts_ = s. 96 // copy constructor 97 //-- 98 { 99 NmaxPts_ = s.NmaxPts_; 109 100 Ouverture_ = s.Ouverture_; 110 101 OmegaTeta_ = s.OmegaTeta_; 111 102 OmegaPhi_ = s.OmegaPhi_; 112 103 OmegaRad_ = s.OmegaRad_; 113 FrequenceEch_ = s. 114 TempsFinal_ = s.TempsFinal_;104 FrequenceEch_ = s.FrequenceEch_; 105 TempsFinal_ = s.TempsFinal_; 115 106 TempsInitial_ = s.TempsInitial_; 116 PhiZero_ = s. PhiZero_; 117 sPix_=new r_8[ NmaxPts_]; 118 int_4 k; 119 for (k=0; k<NmaxPts_; k++) sPix_[k]=s.sPix_[k]; 120 for (k=0; k<9; k++) Rota_[k]=s. Rota_[k]; 121 } 122 //++ 123 // Titre Destructeur 107 PhiZero_ = s.PhiZero_; 108 sPix_=s.sPix_; 109 for (int k=0; k<9; k++) Rota_[k]=s. Rota_[k]; 110 } 111 //++ 112 // Titre Destructor 124 113 //-- 125 114 //++ … … 129 118 //-- 130 119 { 131 delete[] sPix_ ; 132 } 133 //++ 134 void Scan::WriteSelf(POutPersist& s) const 135 136 // créer un fichier persistant 137 //-- 138 { 139 char strg[256]; 140 if (mInfo_) {sprintf(strg, "Scan: Theta=%9f Phi=%9f omega=%9f HasInfo", (float)OmegaTeta_, (float)OmegaPhi_, (float)OmegaRad_); 141 } 142 else {sprintf(strg, "Scan: Theta=%9f Phi=%9f omega=%9f ", (float)OmegaTeta_, (float)OmegaPhi_, (float)OmegaRad_); 143 } 144 s.PutLine(strg); 145 if (mInfo_) s << (*mInfo_); 146 s.PutI4( NmaxPts_); 147 s.PutI4(NmaxTrs_); 148 s.PutI4( NPts1Tr_); 149 s.PutR4(Ouverture_); 150 s.PutR4(OmegaTeta_); 151 s.PutR4(OmegaPhi_); 152 s.PutR4(OmegaRad_); 153 s.PutR4(FrequenceEch_); 154 s.PutR4(TempsFinal_); 155 s.PutR4( TempsInitial_); 156 s.PutR4( PhiZero_); 157 s.PutR8s(sPix_,NmaxPts_); 158 s.PutR8s(Rota_, 9); 159 return; 160 } 161 162 163 //++ 164 void Scan::ReadSelf(PInPersist& s) 165 166 // relire un fichier persistant 167 //-- 168 { 169 Clear(); 170 char strg[256]; 171 s.GetLine(strg,255); 172 // Pour savoir s'il y avait un DVList Info associe 173 bool hadinfo = false; 174 if (strncmp(strg+strlen(strg)-7, "HasInfo", 7) == 0) hadinfo = true; 175 // Pour savoir s'il y avait un DVList Info associe 176 if (hadinfo) { // Lecture eventuelle du DVList Info 177 if (mInfo_ == NULL) mInfo_ = new DVList; 178 s >> (*mInfo_); 179 } 180 s.GetI4( NmaxPts_); 181 s.GetI4(NmaxTrs_); 182 s.GetI4( NPts1Tr_); 183 s.GetR4(Ouverture_); 184 s.GetR4(OmegaTeta_); 185 s.GetR4(OmegaPhi_); 186 s.GetR4(OmegaRad_); 187 s.GetR4(FrequenceEch_); 188 s.GetR4(TempsFinal_); 189 s.GetR4( TempsInitial_); 190 s.GetR4( PhiZero_); 191 sPix_=new r_8[NmaxPts_]; 192 s.GetR8s(sPix_,NmaxPts_); 193 s.GetR8s(Rota_, 9); 194 } 195 196 197 //++ 198 // Titre Méthodes 120 // delete[] sPix_ ; 121 } 122 123 124 //++ 125 // Titre Public Methods 199 126 //-- 200 127 … … 202 129 int_4 Scan::NbPoints() const 203 130 204 // Ret ourne le nombre de Points duscan131 // Return the number of points in the scan 205 132 //-- 206 133 { … … 212 139 int_4 Scan::NbTours() const 213 140 214 // Ret ourne le nombre total de tours141 // Return total nomber of turns 215 142 //-- 216 143 { … … 222 149 int_4 Scan::NbPts1Tr() const 223 150 224 // Ret ourne le nombre de points pour 1 tour151 // Return nomber of points for 1 turn 225 152 //-- 226 153 { … … 232 159 int_4 Scan::ValueIndex(float t) const 233 160 234 // Ret ourne l'indice du pixel associé au tempst161 // Return index of pixel associated to time t 235 162 //-- 236 163 { … … 256 183 void Scan::Direction(float t, float& teta , float& phi) 257 184 258 // Ret ourne les coordonnées (teta,phi) du pixel lié au tempst185 // Return (teta,phi) coordinate of pixel related to time t 259 186 //-- 260 187 { … … 282 209 void Scan::DirectionIndex(int_4 k, float& teta, float& phi) 283 210 284 // Ret ourne les coordonnées (teta,phi) du pixel d'indicek211 // Return (teta,phi) coordinates of pixel with index k 285 212 //-- 286 213 { … … 297 224 /* --Methode-- */ 298 225 //++ 299 r_8 & Scan::PixelValue(int_4 k) const226 r_8 const& Scan::PixelValue(int_4 k) const 300 227 301 228 // Retourne la valeur du contenu du pixel d'indice k … … 306 233 return(dummy_pixel); 307 234 } 308 return(sPix_[k]); 309 } 310 311 void Scan::Clear() { 312 if (sPix_) delete[] sPix_; 313 } 235 // return(sPix_[k]); 236 //return(sPix_(k)); 237 return *(sPix_.Data()+k); 238 } 239 //++ 240 r_8 & Scan::PixelValue(int_4 k) 241 242 // Retourne la valeur du contenu du pixel d'indice k 243 //-- 244 { 245 if ( (k<0) || (k >= NmaxPts_) ) { 246 printf("\n ValueIndex::indice du pixel errone k= %d",k); 247 return(dummy_pixel); 248 } 249 // return(sPix_[k]); 250 //return(sPix_(k)); 251 return *(sPix_.Data()+k); 252 } 253 254 //void Scan::Clear() { 255 // if (sPix_) delete[] sPix_; 256 //} 314 257 void Scan::InitNull() { 315 sPix_=NULL; 258 // sPix_=NULL; 259 sPix_.Reset(); 316 260 mInfo_=NULL; 317 261 } 318 319 320 //++ 321 // Titre Opérateurs 262 Scan& Scan::operator = (const Scan& s) 263 { 264 NmaxPts_ = s.NmaxPts_; 265 Ouverture_ = s.Ouverture_; 266 OmegaTeta_ = s.OmegaTeta_; 267 OmegaPhi_ = s.OmegaPhi_; 268 OmegaRad_ = s.OmegaRad_; 269 FrequenceEch_ = s.FrequenceEch_; 270 TempsFinal_ = s.TempsFinal_; 271 TempsInitial_ = s.TempsInitial_; 272 PhiZero_ = s.PhiZero_; 273 sPix_=s.sPix_; 274 for (int k=0; k<9; k++) Rota_[k]=s. Rota_[k]; 275 return *this; 276 } 277 278 279 //++ 280 // Titre Operators 322 281 //-- 323 282 //++ … … 325 284 //-- 326 285 //++ 327 // Surcharge de la parenthese a un indice entier : remplit ou/et renvoie 328 // la valeur du contenu du pixel d'indice k 329 //-- 330 331 332 333 334 286 // fill and/or return value of the pixel with index k 287 //-- 288 289 290 291 292 293 //++ 294 // Titre class FIO_Scan 295 // Delegated objects for persitance management 296 //-- 297 298 //******************************************************************* 299 // class FIO_Scan 300 // Les objets delegues pour la gestion de persistance 301 //******************************************************************* 302 303 //++ 304 FIO_Scan::FIO_Scan() 305 // 306 //-- 307 { 308 dobj= new Scan; 309 ownobj= true; 310 } 311 //++ 312 FIO_Scan::FIO_Scan(string const& filename) 313 // 314 //-- 315 { 316 dobj= new Scan; 317 ownobj= true; 318 Read(filename); 319 } 320 //++ 321 FIO_Scan::FIO_Scan(const Scan& obj) 322 // 323 //-- 324 { 325 dobj= new Scan(obj); 326 ownobj= true; 327 } 328 FIO_Scan::FIO_Scan(Scan* obj) 329 { 330 dobj= obj; 331 ownobj= false; 332 } 333 //++ 334 FIO_Scan::~FIO_Scan() 335 // 336 //-- 337 { 338 if (ownobj && dobj) delete dobj; 339 } 340 //++ 341 AnyDataObj* FIO_Scan::DataObj() 342 // 343 //-- 344 { 345 return(dobj); 346 } 347 348 //++ 349 void FIO_Scan::ReadSelf(PInPersist& is) 350 // 351 //-- 352 { 353 354 int NmaxPts, NmaxTrs, NPts1Tr; 355 r_4 Ouverture, OmegaTeta, OmegaPhi, OmegaRad, FrequenceEch; 356 r_4 TempsFinal, TempsInitial, PhiZero; 357 r_8 Rota[9]; 358 359 if(dobj == NULL) 360 { 361 dobj= new Scan; 362 } 363 364 // Pour savoir s'il y avait un DVList Info associe 365 char strg[256]; 366 is.GetLine(strg, 255); 367 bool hadinfo= false; 368 if (strncmp(strg+strlen(strg)-7, "HasInfo", 7) == 0) hadinfo = true; 369 if(hadinfo) 370 { // Lecture eventuelle du DVList Info 371 is >> dobj->Info(); 372 } 373 374 375 is.GetI4(NmaxPts); 376 is.GetI4(NmaxTrs); 377 is.GetI4(NPts1Tr); 378 dobj->SetIntParams(NmaxPts,NmaxTrs,NPts1Tr); 379 380 is.GetR4(Ouverture); 381 is.GetR4(OmegaTeta); 382 is.GetR4(OmegaPhi); 383 is.GetR4(OmegaRad); 384 is.GetR4(FrequenceEch); 385 is.GetR4(TempsFinal); 386 is.GetR4(TempsInitial); 387 is.GetR4(PhiZero); 388 is.GetR8s(Rota, 9); 389 dobj->SetFloatParams(Ouverture,OmegaTeta,OmegaPhi,OmegaRad, 390 FrequenceEch,TempsFinal,TempsInitial,PhiZero,Rota); 391 r_8* sPix=new r_8[NmaxPts]; 392 PIOSReadArray(is, sPix, NmaxPts); 393 dobj->setDataBlock(sPix, NmaxPts); 394 delete [] sPix; 395 } 396 //++ 397 void FIO_Scan::WriteSelf(POutPersist& os) const 398 // 399 //-- 400 { 401 r_4 Ouverture, OmegaTeta, OmegaPhi, OmegaRad, FrequenceEch; 402 r_4 TempsFinal, TempsInitial, PhiZero; 403 r_8 Rota[9]; 404 char strg[256]; 405 406 if(dobj == NULL) 407 { 408 cout << " FIO_Scan::WriteSelf:: dobj= null " << endl; 409 return; 410 } 411 dobj->GetFloatParams(Ouverture,OmegaTeta,OmegaPhi,OmegaRad, 412 FrequenceEch,TempsFinal,TempsInitial,PhiZero,Rota); 413 if (dobj->ptrInfo()) 414 {sprintf(strg, "Scan: Theta=%9f Phi=%9f omega=%9f HasInfo", 415 (float)OmegaTeta, (float)OmegaPhi, (float)OmegaRad); 416 os.PutLine(strg); 417 os << dobj->Info(); 418 } 419 else 420 { 421 sprintf(strg, "Scan: Theta=%9f Phi=%9f omega=%9f ", 422 (float)OmegaTeta, (float)OmegaPhi, (float)OmegaRad); 423 os.PutLine(strg); 424 } 425 426 os.PutI4(dobj->NbPoints()); 427 os.PutI4(dobj->NbTours()); 428 os.PutI4(dobj->NbPts1Tr()); 429 430 os.PutR4(Ouverture); 431 os.PutR4(OmegaTeta); 432 os.PutR4(OmegaPhi); 433 os.PutR4(OmegaRad); 434 os.PutR4(FrequenceEch); 435 os.PutR4(TempsFinal); 436 os.PutR4(TempsInitial); 437 os.PutR4(PhiZero); 438 os.PutR8s(Rota, 9); 439 440 PIOSWriteArray(os,(dobj->getDataBlock())->Data(), dobj->NbPoints()); 441 442 }
Note:
See TracChangeset
for help on using the changeset viewer.