| 1 | // Dominique YVON, CEA/DAPNIA/SPP 02/2000 | 
|---|
| 2 | #include <math.h> | 
|---|
| 3 | #ifdef __MWERKS__ | 
|---|
| 4 | #include "mwerksmath.h" | 
|---|
| 5 | #include "unixmac.h" | 
|---|
| 6 | #endif | 
|---|
| 7 |  | 
|---|
| 8 | #include "abslightsource.h" | 
|---|
| 9 | #include "lsrcradspec.h" | 
|---|
| 10 |  | 
|---|
| 11 |  | 
|---|
| 12 |  | 
|---|
| 13 | UnitVector AbsLightSource::GetVSrcCenter() { | 
|---|
| 14 | //Make sense only for QuasiPointSource | 
|---|
| 15 | cerr<<"Call for GetVSrcCenter() for a non QuasiPointSource: exit"<<endl; | 
|---|
| 16 | exit(-1); | 
|---|
| 17 | UnitVector vec; | 
|---|
| 18 | return vec; | 
|---|
| 19 | } | 
|---|
| 20 |  | 
|---|
| 21 | double AbsLightSource::planckSpecDiff(double DTempe, double freq, double Tempe) | 
|---|
| 22 | { // W/m2/st/Hz | 
|---|
| 23 | double h_kT=4.800e-11/Tempe; | 
|---|
| 24 | double prefac= 2*6.626e-34*6.626e-34/(9.e16*1.38e-23*Tempe*Tempe); | 
|---|
| 25 | // | 
|---|
| 26 | return prefac*pow(freq,4)*exp(h_kT*freq)/pow((exp(h_kT*freq)-1.),2)*DTempe; | 
|---|
| 27 | } | 
|---|
| 28 |  | 
|---|
| 29 | double AbsLightSource::planckSpectrum(double freq, double Tempe){ | 
|---|
| 30 | double h_kT=4.800e-11/Tempe; | 
|---|
| 31 | double prefac=2.*6.626e-34/9.e16;                    //2*h/c^2 | 
|---|
| 32 | return prefac*freq*freq*freq/(exp(h_kT*freq)-1.); | 
|---|
| 33 | // units (J m-3 Hz-1) | 
|---|
| 34 | // Very usefull spectrum! | 
|---|
| 35 | // W/m2/st/Hz | 
|---|
| 36 | } | 
|---|
| 37 |  | 
|---|
| 38 | LSrcRadSpec AbsLightSource::getPowerSpec(double theta,double phi) { | 
|---|
| 39 | // Return Object including power spectrum versus frequency in direction theta, phi | 
|---|
| 40 | // (W/m2/Hz/St) | 
|---|
| 41 | // Not recommended for intensive use. May Be inefficient or inaccurrate | 
|---|
| 42 | return LSrcRadSpec(this, theta, phi); | 
|---|
| 43 | } | 
|---|
| 44 |  | 
|---|
| 45 | void AbsLightSource::print(ostream& OutStr) const | 
|---|
| 46 | {       OutStr<<"Source de lumiere: "<<Name<<endl; | 
|---|
| 47 | OutStr<<"Resolution: "<< resolution<<endl; | 
|---|
| 48 | return ; | 
|---|
| 49 | } | 
|---|
| 50 |  | 
|---|