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
Line 
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: nupower.cc,v 1.6 2000-04-13 14:10:44 ansari Exp $
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
23
24/*!
25 * \class SOPHYA::PowerLawSpectra <BR>
26 * This class corresponds to a power law radiation spectrum.
27*/
28PowerLawSpectra::PowerLawSpectra()
29{
30}
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)
39 : RadSpectra(numin, numax)
40{
41 _a = A;
42 _b = B;
43 _nu0 = nu0;
44 _dnu = (dnu > 1.e-19) ? dnu : 1.;
45}
46
47
48PowerLawSpectra::~PowerLawSpectra()
49{
50}
51/*! Flux function according to the <a href="#psldef"> above </a>
52 equation */
53double
54PowerLawSpectra::flux(double nu) const
55{
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) );
60}
61
62
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/*
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
88void
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
101*/
Note: See TracBrowser for help on using the repository browser.