[1151] | 1 | #include <fstream>
|
---|
| 2 | #include "unitvector.h"
|
---|
| 3 | #include "lightptsrclevsinband.h"
|
---|
| 4 |
|
---|
| 5 |
|
---|
| 6 | LightPtSrcLevSInBand::LightPtSrcLevSInBand(char FileOfPtSrc[])
|
---|
| 7 | { // le fichier de pointsource ordonn en Theta
|
---|
| 8 | sprintf(Name, "Sources Ponctuelles du Level S");
|
---|
| 9 | readLevSPtSrc(FileOfPtSrc);
|
---|
| 10 | }
|
---|
| 11 |
|
---|
| 12 | void LightPtSrcLevSInBand::readLevSPtSrc(char PtSrcfile[])
|
---|
| 13 | { char Line[200];
|
---|
| 14 |
|
---|
| 15 | double theta, phi;
|
---|
| 16 | float f30, f44, f70, f100, f143, f217, f352, f545, f857;
|
---|
| 17 | LevSPtSrcData UneSource;
|
---|
| 18 | UnitVector UnCoord;
|
---|
| 19 |
|
---|
| 20 | ifstream HFI(PtSrcfile);
|
---|
| 21 | if (!HFI)
|
---|
| 22 | { cout<< "Erreur a l'ouverture du fichier de donnees :"<<PtSrcfile<< endl;
|
---|
| 23 | exit(-1);
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | long compteur=0;
|
---|
| 27 | long compteur2=0;
|
---|
| 28 | while (HFI)
|
---|
| 29 | { // Data in file in radian and Jansky
|
---|
| 30 | HFI>>theta;
|
---|
| 31 | HFI>>phi;
|
---|
| 32 | HFI>>f30;
|
---|
| 33 | HFI>>f44;
|
---|
| 34 | HFI>>f70;
|
---|
| 35 | HFI>>f100;
|
---|
| 36 | HFI>>f143;
|
---|
| 37 | HFI>>f217;
|
---|
| 38 | HFI>>f352;
|
---|
| 39 | HFI>>f545;
|
---|
| 40 | HFI>>f857;
|
---|
| 41 |
|
---|
| 42 | compteur++;
|
---|
| 43 | if(HFI.fail())
|
---|
| 44 | { HFI.clear();
|
---|
| 45 | HFI.getline(Line, 199);
|
---|
| 46 | if(HFI.eof())
|
---|
| 47 | { cerr<< "Fin de lecture du fichier: "<<PtSrcfile<<endl;
|
---|
| 48 | cerr<< "Point source number : "<<MapOfPtSrc.size()<<endl;
|
---|
| 49 | break;
|
---|
| 50 | }
|
---|
| 51 | else cerr<<"erreur lecture ligne: "<<Line<<endl;
|
---|
| 52 | }
|
---|
| 53 | else
|
---|
| 54 | { // cout<<theta<<'\t'<<phi<<'\t'<<f30<<'\t'<<f44<<'\t'<<f70<<'\t'<<f100;
|
---|
| 55 | // cout<<'\t'<<f143<<'\t'<<f217<<'\t'<<f352<<'\t'<<f545<<'\t'<<f857<<endl<<endl;
|
---|
| 56 |
|
---|
| 57 | // In Memory Power is sored in Watt, angles in Radian
|
---|
| 58 | UnitVector UnCoord(theta, phi);
|
---|
| 59 | UneSource.flux30G=f30*1.e-26;
|
---|
| 60 | UneSource.flux44G=f44*1.e-26;
|
---|
| 61 | UneSource.flux70G=f70*1.e-26;
|
---|
| 62 | UneSource.flux100G=f100*1.e-26;
|
---|
| 63 | UneSource.flux143G=f143*1.e-26;
|
---|
| 64 | UneSource.flux217G=f217*1.e-26;
|
---|
| 65 | UneSource.flux352G=f352*1.e-26;
|
---|
| 66 | UneSource.flux545G=f545*1.e-26;
|
---|
| 67 | UneSource.flux857G=f857*1.e-26;
|
---|
| 68 |
|
---|
| 69 | const pair<const UnitVector, LevSPtSrcData> UneValeur=make_pair(UnCoord, UneSource);
|
---|
| 70 |
|
---|
| 71 | MapOfPtSrc.insert(MapOfPtSrc.end(),UneValeur);
|
---|
| 72 | compteur2++;
|
---|
| 73 | }
|
---|
| 74 | }
|
---|
| 75 | cerr<< compteur<<'\t'<<compteur2<<endl;
|
---|
| 76 | return;
|
---|
| 77 | }
|
---|