| 1 | // Dominique YVON, CEA/DAPNIA/SPP 02/2000 | 
|---|
| 2 |  | 
|---|
| 3 | #include <iomanip.h> | 
|---|
| 4 | #ifdef __MWERKS__ | 
|---|
| 5 | #include "macenvvariables.h" | 
|---|
| 6 | #else | 
|---|
| 7 | # define ERROR_LABEL -32768 | 
|---|
| 8 | #endif | 
|---|
| 9 |  | 
|---|
| 10 | #include "makebolotimeline.h" | 
|---|
| 11 |  | 
|---|
| 12 |  | 
|---|
| 13 | MakeBoloTimeline::MakeBoloTimeline(char file[], AbsLightSource& LSrc, | 
|---|
| 14 | AbsLobeNoPolar& Lobe, SpectralResponse &Filter, Normalisation Norm) | 
|---|
| 15 | :tool(&LSrc,&Lobe,&Filter), NormMethode(Norm) | 
|---|
| 16 | { | 
|---|
| 17 | #ifndef __MWERKS__ | 
|---|
| 18 | char* PATHResults=getenv("PATHResults"); | 
|---|
| 19 | #endif | 
|---|
| 20 | char filecur[150]; | 
|---|
| 21 | // On remplit le ReadMe | 
|---|
| 22 | sprintf(filecur,"%s%s.ReadMe", PATHResults,file); | 
|---|
| 23 | cout<<filecur<<endl; | 
|---|
| 24 | ofstream ReadMe(filecur,ios::out|ios::trunc); | 
|---|
| 25 |  | 
|---|
| 26 | ReadMe<<" Fichier de timeline pour:"<<endl; | 
|---|
| 27 | ReadMe<<" La source physique: "<<endl; | 
|---|
| 28 | LSrc.print(ReadMe); | 
|---|
| 29 | ReadMe<<" Le Lobe : "<<endl; | 
|---|
| 30 | Lobe.print(ReadMe); | 
|---|
| 31 | ReadMe<<" Le Filtre: "<<endl; | 
|---|
| 32 | Filter.Print(ReadMe); | 
|---|
| 33 | ReadMe<<endl; | 
|---|
| 34 |  | 
|---|
| 35 | NormRJ=tool.NormKelvinRayleighJeans(); | 
|---|
| 36 | NormTCMB=tool.NormKelvinCMB(); | 
|---|
| 37 |  | 
|---|
| 38 | //      ReadMe.setf(ios::scientific); | 
|---|
| 39 | ReadMe<< setprecision(3); | 
|---|
| 40 | ReadMe<<" Constantes de normalisation"<<endl; | 
|---|
| 41 | ReadMe<<" RayleighJeans: "<<NormRJ<< " KelvinRJ/(W/m2)"<<endl; | 
|---|
| 42 | ReadMe<<" TempeCMB: "<<NormTCMB<< " Kelvin CMB/(W/m2)"<<endl; | 
|---|
| 43 |  | 
|---|
| 44 | ReadMe<<"Cette carte est en unit: "; | 
|---|
| 45 | switch(NormMethode) | 
|---|
| 46 | { | 
|---|
| 47 | case TempeCMB: | 
|---|
| 48 | {       ReadMe<< "Kelvin CMB"<<endl; | 
|---|
| 49 | break; | 
|---|
| 50 | } | 
|---|
| 51 | case RayleighJeans: | 
|---|
| 52 | {       ReadMe<< "Kelvin RayleighJeans"<<endl; | 
|---|
| 53 | break; | 
|---|
| 54 | } | 
|---|
| 55 | default: ReadMe<< "Watt/m2 effectif de mirroir"<<endl; | 
|---|
| 56 | } | 
|---|
| 57 | ReadMe<<"Fichier ecrit selon le format"<<endl; | 
|---|
| 58 | ReadMe<<"Radian\tRadian\tAbove Unit"<<endl; | 
|---|
| 59 |  | 
|---|
| 60 | // J'espere que c'est assez | 
|---|
| 61 | ReadMe.close(); | 
|---|
| 62 |  | 
|---|
| 63 | sprintf(filecur,"%s%s.dat", PATHResults,file); | 
|---|
| 64 |  | 
|---|
| 65 | pMystr= new ofstream(filecur,ios::out|ios::trunc); | 
|---|
| 66 | //      pMystr->setf(ios::scientific); | 
|---|
| 67 | (*pMystr)<<setprecision(5); | 
|---|
| 68 | } | 
|---|
| 69 |  | 
|---|
| 70 | void MakeBoloTimeline::addToStreamArchTOI(double theta,double phi) | 
|---|
| 71 | {       //       Theta en heures, Phi en degres | 
|---|
| 72 | if((theta==ERROR_LABEL)||(phi==ERROR_LABEL)) return; | 
|---|
| 73 | double thetaRad=theta*15./180*M_PI; | 
|---|
| 74 | double phiRad=phi/180.*M_PI; | 
|---|
| 75 |  | 
|---|
| 76 | addToStream(theta,phi); | 
|---|
| 77 | } | 
|---|
| 78 |  | 
|---|
| 79 | void MakeBoloTimeline::addToStream(double theta,double phi) | 
|---|
| 80 | {       // theta et Phi en Radian. | 
|---|
| 81 | switch (NormMethode) | 
|---|
| 82 | { | 
|---|
| 83 | case RayleighJeans: | 
|---|
| 84 | {       double TempeRJ= NormRJ*tool.compPixel(theta,phi); | 
|---|
| 85 | (*pMystr)<<theta<<'\t'<<phi<<'\t'<<TempeRJ<<'\n'; | 
|---|
| 86 | return; | 
|---|
| 87 | } | 
|---|
| 88 | case TempeCMB: | 
|---|
| 89 | {       double tempeCMB= NormTCMB*tool.compPixel(theta,phi); | 
|---|
| 90 | (*pMystr)<<theta<<'\t'<<phi<<'\t'<<tempeCMB<<'\n'; | 
|---|
| 91 | return; | 
|---|
| 92 | } | 
|---|
| 93 | default: | 
|---|
| 94 | {       double power=tool.compPixel(theta,phi); | 
|---|
| 95 | (*pMystr)<<theta<<'\t'<<phi<<'\t'<<power<<'\n'; | 
|---|
| 96 | return; | 
|---|
| 97 | } | 
|---|
| 98 | } | 
|---|
| 99 | } | 
|---|