#include <Units.hpp>
Public Types | |
enum class | FluxOutputStyle : int { Neutral , Wavelength , Frequency , Energy } |
enum class | WavelengthOutputStyle : int { Wavelength , Frequency , Energy } |
Public Member Functions | |
std::tuple< double, double, double > | def (string qty, string unit) const |
FluxOutputStyle | fluxOutputStyle () const |
bool | has (string qty, string unit) const |
double | in (string qty, string unit, double value) const |
double | oangle (double theta) const |
double | obolluminosity (double L) const |
double | obolluminositysurfacedensity (double L) const |
double | obolluminosityvolumedensity (double L) const |
double | obulkmass (double mu) const |
double | obulkmassdensity (double rho) const |
double | odistance (double d) const |
double | oenergy (double E) const |
double | ofluxdensity (double lambda, double Flambda) const |
double | ograinsize (double a) const |
double | olength (double x) const |
double | omagneticfield (double B) const |
double | omass (double M) const |
double | omasscoefficient (double kappa) const |
double | omasssurfacedensity (double Sigma) const |
double | omassvolumedensity (double rho) const |
double | omeanintensity (double lambda, double Jlambda) const |
double | omonluminosity (double lambda, double Llambda) const |
double | omonluminosityvolumedensity (double lambda, double Llambda) const |
double | onumbersurfacedensity (double N) const |
double | onumbervolumedensity (double n) const |
double | opergrainsize (double a) const |
double | oposangle (double theta) const |
double | opressure (double p) const |
double | osection (double C) const |
double | osolidangle (double Omega) const |
double | osurfacebrightness (double lambda, double flambda) const |
double | otemperature (double T) const |
double | out (string qty, double value) const |
double | ovelocity (double v) const |
double | ovolume (double V) const |
double | owavelength (double lambda) const |
bool | rwavelength () const |
string | sfluxdensity () const |
string | smeanintensity () const |
string | smonluminosity () const |
string | smonluminosityvolumedensity () const |
string | ssurfacebrightness () const |
string | swavelength () const |
string | uangle () const |
string | ubolluminosity () const |
string | ubolluminositysurfacedensity () const |
string | ubolluminosityvolumedensity () const |
string | ubulkmass () const |
string | ubulkmassdensity () const |
string | udistance () const |
string | uenergy () const |
string | ufluxdensity () const |
string | ugrainsize () const |
string | ulength () const |
string | umagneticfield () const |
string | umass () const |
string | umasscoefficient () const |
string | umasssurfacedensity () const |
string | umassvolumedensity () const |
string | umeanintensity () const |
string | umonluminosity () const |
string | umonluminosityvolumedensity () const |
string | unit (string qty) const |
string | unumbersurfacedensity () const |
string | unumbervolumedensity () const |
string | upergrainsize () const |
string | uposangle () const |
string | upressure () const |
string | usection () const |
string | usolidangle () const |
string | usurfacebrightness () const |
string | utemperature () const |
string | uvelocity () const |
string | uvolume () const |
string | uwavelength () const |
WavelengthOutputStyle | wavelengthOutputStyle () const |
![]() | |
template<class T > | |
T * | find (bool setup=true) const |
template<class T > | |
T * | interface (int levels=-999999, bool setup=true) const |
virtual string | itemName () const |
void | setup () |
string | typeAndName () const |
![]() | |
Item (const Item &)=delete | |
virtual | ~Item () |
void | addChild (Item *child) |
const vector< Item * > & | children () const |
virtual void | clearItemListProperty (const PropertyDef *property) |
void | destroyChild (Item *child) |
virtual bool | getBoolProperty (const PropertyDef *property) const |
virtual vector< double > | getDoubleListProperty (const PropertyDef *property) const |
virtual double | getDoubleProperty (const PropertyDef *property) const |
virtual string | getEnumProperty (const PropertyDef *property) const |
virtual int | getIntProperty (const PropertyDef *property) const |
virtual vector< Item * > | getItemListProperty (const PropertyDef *property) const |
virtual Item * | getItemProperty (const PropertyDef *property) const |
virtual string | getStringProperty (const PropertyDef *property) const |
int | getUtilityProperty (string name) const |
virtual void | insertIntoItemListProperty (const PropertyDef *property, int index, Item *item) |
Item & | operator= (const Item &)=delete |
Item * | parent () const |
virtual void | removeFromItemListProperty (const PropertyDef *property, int index) |
virtual void | setBoolProperty (const PropertyDef *property, bool value) |
virtual void | setDoubleListProperty (const PropertyDef *property, vector< double > value) |
virtual void | setDoubleProperty (const PropertyDef *property, double value) |
virtual void | setEnumProperty (const PropertyDef *property, string value) |
virtual void | setIntProperty (const PropertyDef *property, int value) |
virtual void | setItemProperty (const PropertyDef *property, Item *item) |
virtual void | setStringProperty (const PropertyDef *property, string value) |
void | setUtilityProperty (string name, int value) |
virtual string | type () const |
Static Public Member Functions | |
template<class Style > | |
static FluxOutputStyle | fluxStyle (Style style) |
static Array | fromFluxStyle (const Array &lambdav, const Array &Lv, FluxOutputStyle style) |
static double | fromFluxStyle (double lambda, double L, FluxOutputStyle style) |
Protected Member Functions | |
Units () | |
![]() | |
SimulationItem () | |
virtual bool | offersInterface (const std::type_info &interfaceTypeInfo) const |
virtual void | setupSelfAfter () |
virtual void | setupSelfBefore () |
![]() | |
Item () | |
Private Types | |
using | BaseType = SimulationItem |
using | ItemType = Units |
Private Attributes | |
FluxOutputStyle | _fluxOutputStyle |
SkirtUnitDef | _unitDef |
WavelengthOutputStyle | _wavelengthOutputStyle |
Friends | |
class | ItemRegistry |
Units is the abstract base class of the classes that represent the unit systems supported by SKIRT for input/output purposes (internally in SKIRT, everything is in SI units). The Units class serves several purposes.
Firstly, the Units base class and its derived classes enable the SMILE units mechanism in SKIRT parameter files, as described in the documentation of the UnitDef class.
Secondly, the Units class allows the user to configure the wavelength and flux output styles as attributes in the SKIRT parameter file.
Finally, the Units class offers functionality for use by other classes in the simulation item hierarchy. It provides functions for converting physical quantities from internal SI units to external output units depending on the unit system (determined by the name of the subclass being called) and, where applicable, on the selected wavelength and flux output styles.
|
strong |
The enumeration type indicating the output style for flux density and surface brightness. Neutral indicates
Neutral : "neutral: λ F_λ = ν F_ν" .
Wavelength : "per unit of wavelength: F_λ" .
Frequency : "per unit of frequency: F_ν" .
Energy : "counts per unit of energy: F_E" .
|
strong |
The enumeration type indicating the output style for spectral values, i.e. as photon wavelength (the internal representation), as photon frequency, or as photon energy.
Wavelength : "as photon wavelength: λ" .
Frequency : "as photon frequency: ν" .
Energy : "as photon energy: E" .
|
inlineprotected |
std::tuple< double, double, double > Units::def | ( | string | qty, |
string | unit | ||
) | const |
This function returns the definition of the specified units in the form of a tuple providing the front factor, power exponent and offset for conversion from input to internal quantities.
|
inline |
This function returns the value of the discoverable FluxOutputStyle enumeration property fluxOutputStyle : "the output style for flux density and surface brightness" .
The default value for this property is given by the conditional value expression "wavelengthOutputStyleEnergy:Energy;Frequency" .
|
inlinestatic |
This template function translates a flux style given as an enumeration with elements corresponding to the specific luminosity quantity strings defined by the SkirtUnitDef class to a FluxOutputStyle flux style.
|
static |
This function converts a list of specific luminosities from a given input style to the internal per-wavelength style, assuming the given corresponding wavelengths. Both the input values and the returned value are in SI units.
|
static |
This function converts a specific luminosity from a given input style to the internal per-wavelength style, assuming a given wavelength. Both the input values and the returned value are in SI units.
bool Units::has | ( | string | qty, |
string | unit | ||
) | const |
This function returns true if the specified combination of physical quantity and unit or unit system is present in the unit definition, and false if not.
double Units::in | ( | string | qty, |
string | unit, | ||
double | value | ||
) | const |
This function converts a physical value from the specified units to internal program units. If the specified combination is not present in the unit definition, the function throws an exception.
double Units::oangle | ( | double | theta | ) | const |
This function converts the angular size
double Units::obolluminosity | ( | double | L | ) | const |
This function converts the bolometric luminosity
double Units::obolluminositysurfacedensity | ( | double | L | ) | const |
This function converts the bolometric luminosity surface density
double Units::obolluminosityvolumedensity | ( | double | L | ) | const |
This function converts the bolometric luminosity volume density
double Units::obulkmass | ( | double | mu | ) | const |
This function converts the bulk mass
double Units::obulkmassdensity | ( | double | rho | ) | const |
This function converts the bulk mass density
double Units::odistance | ( | double | d | ) | const |
This function converts the distance
double Units::oenergy | ( | double | E | ) | const |
This function converts the energy
double Units::ofluxdensity | ( | double | lambda, |
double | Flambda | ||
) | const |
This function converts the per-wavelength flux density
double Units::ograinsize | ( | double | a | ) | const |
This function converts the dust grain size
double Units::olength | ( | double | x | ) | const |
This function converts the length
double Units::omagneticfield | ( | double | B | ) | const |
This function converts the magnetic field strength
double Units::omass | ( | double | M | ) | const |
This function converts the mass
double Units::omasscoefficient | ( | double | kappa | ) | const |
This function converts the mass coefficient
double Units::omasssurfacedensity | ( | double | Sigma | ) | const |
This function converts the mass surface density
double Units::omassvolumedensity | ( | double | rho | ) | const |
This function converts the mass volume density
double Units::omeanintensity | ( | double | lambda, |
double | Jlambda | ||
) | const |
This function converts the per-wavelength mean intensity
double Units::omonluminosity | ( | double | lambda, |
double | Llambda | ||
) | const |
This function converts the monochromatic per-wavelength luminosity
double Units::omonluminosityvolumedensity | ( | double | lambda, |
double | Llambda | ||
) | const |
This function converts the monochromatic per-wavelength luminosity volume density
double Units::onumbersurfacedensity | ( | double | N | ) | const |
This function converts the number surface density
double Units::onumbervolumedensity | ( | double | n | ) | const |
This function converts the number volume density
double Units::opergrainsize | ( | double | a | ) | const |
This function converts a quantity with units of inverse dust grain size from the internally used SI units (1/m) to the program's output units.
double Units::oposangle | ( | double | theta | ) | const |
This function converts the positioning angle
double Units::opressure | ( | double | p | ) | const |
This function converts the pressure
double Units::osection | ( | double | C | ) | const |
This function converts the volume
double Units::osolidangle | ( | double | Omega | ) | const |
This function converts the solid angle
double Units::osurfacebrightness | ( | double | lambda, |
double | flambda | ||
) | const |
This function converts the per-wavelength surface brightness
double Units::otemperature | ( | double | T | ) | const |
This function converts the temperature
double Units::out | ( | string | qty, |
double | value | ||
) | const |
This function converts a physical value from internal SI units to the output units adopted by the program. The name of the physical quantity must be specified in all lowercase and without any spaces. If the specified combination of physical quantity and unit is unknown, the function throws a fatal error.
double Units::ovelocity | ( | double | v | ) | const |
This function converts the velocity
double Units::ovolume | ( | double | V | ) | const |
This function converts the volume
double Units::owavelength | ( | double | lambda | ) | const |
This function converts the wavelength
bool Units::rwavelength | ( | ) | const |
This function returns true if wavelength values are ordered in reverse in the wavelength output style adopted by the program, and false otherwise. Specifically, it returns false for the output style 'wavelength' and true for the output styles 'frequency' and 'energy'.
string Units::sfluxdensity | ( | ) | const |
This function returns a string describing the flux density output style adopted by the program.
string Units::smeanintensity | ( | ) | const |
This function returns a string describing the mean intensity output style adopted by the program.
string Units::smonluminosity | ( | ) | const |
This function returns a string describing the monochromatic luminosity output style adopted by the program.
string Units::smonluminosityvolumedensity | ( | ) | const |
This function returns a string describing the monochromatic luminosity volume density output style adopted by the program.
string Units::ssurfacebrightness | ( | ) | const |
This function returns a string describing the surface brightness output style adopted by the program.
string Units::swavelength | ( | ) | const |
This function returns a string describing the wavelength output style adopted by the program.
string Units::uangle | ( | ) | const |
This function returns a string containing the name of the unit of angular size adopted by the program for output.
string Units::ubolluminosity | ( | ) | const |
This function returns a string containing the name of the unit of bolometric luminosity adopted by the program for output.
string Units::ubolluminositysurfacedensity | ( | ) | const |
This function returns a string containing the name of the unit of bolometric luminosity surface density adopted by the program for output.
string Units::ubolluminosityvolumedensity | ( | ) | const |
This function returns a string containing the name of the unit of bolometric luminosity volume density adopted by the program for output.
string Units::ubulkmass | ( | ) | const |
This function returns a string containing the name of the unit of bulk mass adopted by the program for output.
string Units::ubulkmassdensity | ( | ) | const |
This function returns a string containing the name of the unit of bulk mass density adopted by the program for output.
string Units::udistance | ( | ) | const |
This function returns a string containing the name of the unit of distance adopted by the program for output. Apart from this unit of distance, the program uses an independent unit of length, because usually the distance to an astronomical object and the typical length scale within an astronomical object are quite different.
string Units::uenergy | ( | ) | const |
This function returns a string containing the name of the unit of energy adopted by the program for output.
string Units::ufluxdensity | ( | ) | const |
This function returns a string containing the name of the unit of flux density adopted by the program for output, depending on the selected flux output style.
string Units::ugrainsize | ( | ) | const |
This function returns a string containing the name of the unit of dust grain size adopted by the program for output.
string Units::ulength | ( | ) | const |
This function returns a string containing the name of the unit of length adopted by the program for output. Apart from this unit of length, the program uses an independent unit of distance, because usually the distance to an astronomical object and the typical length scale within an astronomical object are quite different.
string Units::umagneticfield | ( | ) | const |
This function returns a string containing the name of the unit of magnetic field adopted by the program for output.
string Units::umass | ( | ) | const |
This function returns a string containing the name of the unit of mass adopted by the program for output.
string Units::umasscoefficient | ( | ) | const |
This function returns a string containing the name of the unit of mass coefficient adopted by the program for output.
string Units::umasssurfacedensity | ( | ) | const |
This function returns a string containing the name of the unit of mass surface density adopted by the program for output.
string Units::umassvolumedensity | ( | ) | const |
This function returns a string containing the name of the unit of mass volume density adopted by the program for output.
string Units::umeanintensity | ( | ) | const |
This function returns a string containing the name of the unit of mean intensity adopted by the program for output, depending on the selected flux output style.
string Units::umonluminosity | ( | ) | const |
This function returns a string containing the name of the unit of monochromatic luminosity adopted by the program for output, depending on the selected flux output style.
string Units::umonluminosityvolumedensity | ( | ) | const |
This function returns a string containing the name of the unit of monochromatic luminosity volume density adopted by the program for output, depending on the selected flux output style.
string Units::unit | ( | string | qty | ) | const |
This function returns a string containing the name of the output unit adopted by the program for the specified physical quantity. The name of the physical quantity must be specified in all lowercase and without any spaces. The function throws a fatal error if the specified physical quantity is unknown.
string Units::unumbersurfacedensity | ( | ) | const |
This function returns a string containing the name of the unit of number surface density adopted by the program for output.
string Units::unumbervolumedensity | ( | ) | const |
This function returns a string containing the name of the unit of number volume density adopted by the program for output.
string Units::upergrainsize | ( | ) | const |
This function returns a string containing the name of the unit of inverse dust grain size adopted by the program for output.
string Units::uposangle | ( | ) | const |
This function returns a string containing the name of the unit of positioning angle adopted by the program for output.
string Units::upressure | ( | ) | const |
This function returns a string containing the name of the unit of pressure adopted by the program for output.
string Units::usection | ( | ) | const |
This function returns a string containing the name of the unit of cross section adopted by the program for output.
string Units::usolidangle | ( | ) | const |
This function returns a string containing the name of the unit of solid angle adopted by the program for output.
string Units::usurfacebrightness | ( | ) | const |
This function returns a string containing the name of the unit of surface brightness adopted by the program for output, depending on the selected flux output style.
string Units::utemperature | ( | ) | const |
This function returns a string containing the name of the unit of temperature adopted by the program for output.
string Units::uvelocity | ( | ) | const |
This function returns a string containing the name of the unit of velocity adopted by the program for output.
string Units::uvolume | ( | ) | const |
This function returns a string containing the name of the unit of volume adopted by the program for output.
string Units::uwavelength | ( | ) | const |
This function returns a string containing the name of the style and unit of wavelength adopted by the program for output.
|
inline |
This function returns the value of the discoverable WavelengthOutputStyle enumeration property wavelengthOutputStyle : "the output style for wavelengths" .
The default value for this property is given by the conditional value expression "Wavelength" .