Gyoto
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
Gyoto::Spectrum::PowerLaw Class Reference

I_nu=constant_*nu^exponent_. More...

#include <GyotoPowerLawSpectrum.h>

Inheritance diagram for Gyoto::Spectrum::PowerLaw:
Gyoto::Spectrum::Generic Gyoto::SmartPointee

Public Member Functions

 PowerLaw (double exponent, double constant=1.)
 Constructor setting exponent_ and optionally constant_.
 
virtual PowerLawclone () const
 Cloner.
 
double getConstant () const
 Get constant_.
 
void setConstant (double)
 Set constant_.
 
double getExponent () const
 Get exponent_.
 
void setExponent (double)
 Set exponent_.
 
virtual double operator() (double nu) const
 I_nu = mySpectrum(nu), nu in Hz. Assumes optically thick regime.
 
virtual void setParameter (std::string name, std::string content, std::string unit)
 To be called by fillElement()
 
virtual void fillElement (FactoryMessenger *fmp) const
 called from Factory More...
 
const std::string getKind () const
 Get spectrum kind.
 
virtual double operator() (double nu, double opacity, double ds) const
 I_nu in optically thin regime. More...
 
virtual double integrate (double nu1, double nu2)
 Integrate optically thick I_nu. More...
 
virtual double integrate (double nu1, double nu2, const Spectrum::Generic *opacity, double ds)
 Integrate optically thin I_nu. More...
 
virtual void setParameters (FactoryMessenger *fmp)
 Main loop in Subcontractor_t function. More...
 

Protected Types

typedef Gyoto::SmartPointer
< Gyoto::SmartPointee
Subcontractor_t (Gyoto::FactoryMessenger *)
 A subcontractor builds an object upon order from the Factory. More...
 

Protected Member Functions

void incRefCount ()
 Increment the reference counter. Warning: Don't mess with the counter.
 
int decRefCount ()
 Decrement the reference counter and return current value. Warning: Don't mess with the counter.
 
int getRefCount ()
 Get the current number of references.
 

Protected Attributes

double constant_
 I_nu=constant_*nu^exponent_.
 
double exponent_
 I_nu=constant_*nu^exponent_.
 
std::string kind_
 e.g. constants, blackbody...
 

Friends

class Gyoto::SmartPointer< Gyoto::Spectrum::PowerLaw >
 

Detailed Description

I_nu=constant_*nu^exponent_.

Light emitted by e.g. a Star.

XML stanza:

* <Spectrum kind="PowerLaw">
* <Exponent> 0. </Exponent>
* <Constant> 1. </Constant>
* </Spectrum>
*

Member Typedef Documentation

typedef Gyoto::SmartPointer<Gyoto::SmartPointee> Gyoto::SmartPointee::Subcontractor_t(Gyoto::FactoryMessenger *)
inherited

A subcontractor builds an object upon order from the Factory.

Various classes need to provide a subcontractor to be able to instanciate themselves upon order from the Factory. A subcontractor is a function (often a static member function) which accepts a pointer to a FactoryMessenger as unique parameter, communicates with the Factory using this messenger to read an XML description of the object to build, and returns this objet. SmartPointee::Subcontractor_t* is just generic enough a typedef to cast to and from other subcontractor types: Astrobj::Subcontractor_t, Metric::Subcontractor_t, Spectrum::Subcontractor_t. A subcontractor needs to be registered using the relevant Register() function: Astrobj::Register(), Metric::Register(), Spectrum::Register().

Member Function Documentation

virtual void Gyoto::Spectrum::PowerLaw::fillElement ( FactoryMessenger fmp) const
virtual

called from Factory

Spectrum implementations should impement fillElement to save their parameters to XML and call the generic implementation to save generic parts.

Reimplemented from Gyoto::Spectrum::Generic.

virtual double Gyoto::Spectrum::Generic::integrate ( double  nu1,
double  nu2 
)
virtualinherited

Integrate optically thick I_nu.

See operator()(double nu) const

Parameters
nu1,nu2boundaries for the integration
Returns
I, the integral of I_nu between nu1 and nu2
virtual double Gyoto::Spectrum::Generic::integrate ( double  nu1,
double  nu2,
const Spectrum::Generic opacity,
double  ds 
)
virtualinherited

Integrate optically thin I_nu.

See operator()(double nu, double opacity, double ds) const

Parameters
nu1,nu2boundaries for the integration
opacitythe frequency-dependent opacity law given as a pointer to a Gyoto::Spectrum::Generic sub-class instance
dsthe element length for spatial integration
Returns
I, the integral of I_nu between nu1 and nu2
virtual double Gyoto::Spectrum::Generic::operator() ( double  nu,
double  opacity,
double  ds 
) const
virtualinherited

I_nu in optically thin regime.

Generic implementation assumes emissivity = opacity.

Parameters
nufrequency in Hz
opacitysuch that opacity*ds=optical thickness.
dsin geometrical units
virtual void Gyoto::Spectrum::Generic::setParameters ( FactoryMessenger fmp)
virtualinherited

Main loop in Subcontractor_t function.

The Subcontractor_t function for each Spectrum kind should look somewhat like this:

* SmartPointer<Spectrum::Generic>
* Gyoto::Spectrum::MyKind::Subcontractor(FactoryMessenger* fmp) {
* SmartPointer<MyKind> sp = new MyKind();
* sp -> setParameters(fmp);
* return sp;
* }
*

Each spectrum kind should implement setParameter(string name, string content) to interpret the individual XML elements. setParameters() can be overloaded in case the specific Spectrum class needs low level access to the FactoryMessenger (see Astrobj::UniformSphere::setParameters()).


The documentation for this class was generated from the following file: