Gyoto
Classes | Typedefs | Functions | Variables
Gyoto::Spectrum Namespace Reference

Spectrum of a simple object (e.g. a Gyoto::Astrobj::Star) More...

Classes

class  BlackBody
 Black Body. More...
 
class  Generic
 Spectrum emitted by an Astrobj. More...
 
class  KappaDistributionSynchrotron
 Kappa-distribution synchrotron spectrum from Pandya et al. (2016) More...
 
class  PowerLaw
 I_nu=constant_*nu^exponent_. More...
 
class  PowerLawSynchrotron
 Powerlaw synchrotron spectrum. More...
 
class  Python
 Loader for Python classes implementing the Spectrum interface. More...
 
class  ThermalBremsstrahlung
 Thermal brems spectrum. More...
 
class  ThermalSynchrotron
 Thermal synchrotron spectrum. More...
 

Typedefs

typedef Gyoto::SmartPointer< Gyoto::Spectrum::GenericSubcontractor_t(Gyoto::FactoryMessenger *fmp, std::vector< std::string > const &)
 A function to build instances of a specific Spectrum::Generic sub-class. More...
 

Functions

template<typename T >
SmartPointer< Spectrum::GenericSubcontractor (FactoryMessenger *fmp, std::vector< std::string > const &plugins)
 Subcontractor template. More...
 
void Register (std::string kind, Gyoto::Spectrum::Subcontractor_t *scp)
 Make a Spectrum kind known to the Factory. More...
 
Gyoto::Spectrum::Subcontractor_tgetSubcontractor (std::string name, std::vector< std::string > &plugins, int errmode=0)
 Query the Spectrum register. More...
 
void initRegister ()
 Empty the Spectrum register. More...
 

Variables

Register::EntryRegister_
 The Spectrum register. More...
 

Detailed Description

Spectrum of a simple object (e.g. a Gyoto::Astrobj::Star)

Typedef Documentation

◆ Subcontractor_t

typedef Gyoto::SmartPointer< Gyoto::Spectrum::Generic > Gyoto::Spectrum::Subcontractor_t(Gyoto::FactoryMessenger *fmp, std::vector< std::string > const &)

A function to build instances of a specific Spectrum::Generic sub-class.

This is a more specific version of the SmartPointee::Subcontractor_t type. A Spectrum::Subcontrator_t is called by the Gyoto::Factory to build an instance of the kind of spectrum specified in an XML file (see Register()). The Factory and Subcontractor_t function communicate through a Gyoto::FactoryMessenger. A template is provided so that you may not have to code anything.

Function Documentation

◆ getSubcontractor()

Gyoto::Spectrum::Subcontractor_t * Gyoto::Spectrum::getSubcontractor ( std::string  name,
std::vector< std::string > &  plugins,
int  errmode = 0 
)

Query the Spectrum register.

Query the Spectrum register to get the Metric::Subcontractor_t correspondig to a given kind name. This function is normally called only from the Factory. If plugin is specified, only a subcontractor matching both name and plugin will be returned, loading the plug-in if necessary. If plugin is the empty string, then the first subcontractor matching name will be returned, and the name of the plug-in it belongs to will be returned in plugin upon output.

Parameters
[in]namee.g. "PowerLaw"
[in,out]plugine.g. "stdplug".
[in]errmodeint=0. If errmode==0, failure to find a registered Spectrum by that name is an error. Else, simply return NULL pointer in that case.
Returns
pointer to the corresponding subcontractor.

◆ initRegister()

void Gyoto::Spectrum::initRegister ( )

Empty the Spectrum register.

This must be called once. It is called by Gyoto::Register::init().

◆ Register()

void Gyoto::Spectrum::Register ( std::string  kind,
Gyoto::Spectrum::Subcontractor_t scp 
)

Make a Spectrum kind known to the Factory.

Register a new Spectrum::Generic sub-class so that the Gyoto::Factory knows it.

Parameters
kindThe kind name which identifies this object type in an XML file, as in <Spectrum kind="name">
scpA pointer to the subcontractor, which will communicate with the Gyoto::Factory to build an instance of the class from its XML description

◆ Subcontractor()

template<typename T >
SmartPointer< Spectrum::Generic > Gyoto::Spectrum::Subcontractor ( FactoryMessenger fmp,
std::vector< std::string > const &  plugins 
)

Subcontractor template.

Instead of reimplementing the wheel, your subcontractor can simply be Gyoto::Spectrum::Subcontractor<MyKind>

Template Parameters
TSub-class of Spectrum::Generic

Variable Documentation

◆ Register_

Register::Entry* Gyoto::Spectrum::Register_
extern

The Spectrum register.

Use the Spectrum::initRegister() once in your program to initiliaze it, the Spectrum::Register() function to fill it, and the Spectrum::getSubcontractor() function to query it.