source: Sophya/trunk/SophyaLib/SkyT/nupower.cc@ 909

Last change on this file since 909 was 909, checked in by ansari, 25 years ago

Sophie: adding documentation for Doxygen in the .cc files:wq

File size: 2.4 KB
RevLine 
[601]1//--------------------------------------------------------------------------
2// File and Version Information:
[909]3// $Id: nupower.cc,v 1.6 2000-04-13 14:10:44 ansari Exp $
[601]4//
5// Description:
6// Aim of the class: To give the energy density for a nupower
7// The unity used here is W/m^2/Hz/sr
8//
9// History (add to end):
10// Sophie Oct, 1999 - creation
11//
12//------------------------------------------------------------------------
13
14//---------------
15// C++ Headers --
16//---------------
17#include "machdefs.h"
18#include <iostream.h>
19#include <math.h>
20
21#include "nupower.h"
22
[909]23
24/*!
25 * \class SOPHYA::PowerLawSpectra <BR>
26 * This class corresponds to a power law radiation spectrum.
27*/
[668]28PowerLawSpectra::PowerLawSpectra()
29{
30}
[909]31/*! Constructor: The arguments corresponds to the Power Law Spectrum
32 equation:
33<a name="psldef"> </a>
34\f[
35\hbox{flux}(\nu) = A ({\nu-\nu_0\over \delta\nu})^B
36\f]
37*/
38PowerLawSpectra::PowerLawSpectra(double A, double B, double nu0, double dnu, double numin, double numax)
[601]39 : RadSpectra(numin, numax)
40{
[909]41 _a = A;
42 _b = B;
[601]43 _nu0 = nu0;
[610]44 _dnu = (dnu > 1.e-19) ? dnu : 1.;
[601]45}
46
47
48PowerLawSpectra::~PowerLawSpectra()
49{
50}
[909]51/*! Flux function according to the <a href="#psldef"> above </a>
52 equation */
[601]53double
54PowerLawSpectra::flux(double nu) const
55{
[610]56 if ((nu< _numin) || (nu > _numax)) return(0.);
57 double tmp = (nu-_nu0)/_dnu;
58 if (tmp <= 0.) return(0.);
59 else return( _a * pow(tmp, _b) );
[601]60}
61
[668]62
[669]63
64void
65PowerLawSpectra::Print(ostream& os) const
66{
67 os << "PowerLawSpectra::Print f = a ((nu-nu0)/dnu)^b " << _a << "((nu-" << _nu0
68 << ") / " << _dnu << ") ^ " << _b << endl;
69 os << " - Fmin,Fmax= " << minFreq() << "," << maxFreq() << endl;
70 os << "MeanFreq= " << meanFreq() << " Emission= " << flux(meanFreq()) << endl;
71 os << "PeakFreq= " << peakFreq() << " Emission= " << flux(peakFreq()) << endl;
72
73}
74
75
76/*
[668]77void
78PowerLawSpectra::WriteSelf(POutPersist& s)
79{
80 s.PutR8(this->giveNorm());
81 s.PutR8(this->giveNu0());
82 s.PutR8(this->giveDNu());
83 s.PutR8(this->giveExp());
84 s.PutR8(this->minFreq());
85 s.PutR8(this->maxFreq());
86}
87
[601]88void
[668]89PowerLawSpectra::ReadSelf(PInPersist& s)
90{
91 s.GetR8(_a);
92 s.GetR8(_nu0);
93 s.GetR8(_dnu);
94 s.GetR8(_b);
95 s.GetR8(_numin);
96 s.GetR8(_numax);
97 cout << " Norm - Nu0 - DNu - Exp - minFreq - maxFreq " << endl;
98 cout << _a << "-" << _nu0 << "-" << _dnu << "-" << _b << "-" << _numin << "-" << _numax << endl;
99}
100
[669]101*/
Note: See TracBrowser for help on using the repository browser.