Gyoto
|
Units-related classes and functions. More...
Classes | |
class | Converter |
Wrapper around ut_converter from udunits. More... | |
class | Unit |
Wrapper around ut_unit from udunits. More... | |
Functions | |
ut_system * | getSystem () |
Retrieve the unit system used in all of Gyoto. | |
void | Init () |
Load and initialize all (non-context-sensitive) units. More... | |
double | ToMeters (double value, const std::string &unit, const Gyoto::SmartPointer< Gyoto::Metric::Generic > &gg=NULL) |
Convert from arbitrary length unit to meters. More... | |
double | FromMeters (double value, const std::string &unit, const Gyoto::SmartPointer< Gyoto::Metric::Generic > &gg=NULL) |
Convert to arbitrary length unit from meters. More... | |
double | ToSeconds (double value, const std::string &unit, const Gyoto::SmartPointer< Gyoto::Metric::Generic > &gg=NULL) |
Convert from arbitrary time unit to seconds. More... | |
double | FromSeconds (double value, const std::string &unit, const Gyoto::SmartPointer< Gyoto::Metric::Generic > &gg=NULL) |
Convert to arbitrary time unit from seconds. More... | |
double | ToKilograms (double value, const std::string &unit) |
Convert from arbitrary mass unit to kilograms. More... | |
double | FromKilograms (double value, const std::string &unit) |
Convert to arbitrary mass unit from kilograms. More... | |
double | ToGeometrical (double value, const std::string &unit, const Gyoto::SmartPointer< Gyoto::Metric::Generic > &gg) |
Convert from arbitrary length unit to geometrical units. More... | |
double | FromGeometrical (double value, const std::string &unit, const Gyoto::SmartPointer< Gyoto::Metric::Generic > &gg) |
Convert to arbitrary length unit from geometrical units. More... | |
double | ToGeometricalTime (double value, const std::string &unit, const Gyoto::SmartPointer< Gyoto::Metric::Generic > &gg) |
Convert from arbitrary time unit to geometrical units. More... | |
double | FromGeometricalTime (double value, const std::string &unit, const Gyoto::SmartPointer< Gyoto::Metric::Generic > &gg) |
Convert to arbitrary time unit from geometrical units. More... | |
double | ToHerz (double value, const std::string &unit) |
Convert from arbitrary frequency unit to Herz. More... | |
double | FromHerz (double value, const std::string &unit) |
Convert to arbitrary frequency unit from Herz. More... | |
bool | areConvertible (const Unit &unit1, const Unit &unit2) |
Is it possible to convert between unit1 and unit2? More... | |
Units-related classes and functions.
Is it possible to convert between unit1 and unit2?
e.g. areConvertible("m", "kg") == 0; areConvertible("m", "km")==1.
Warning: angle units are dimensionless, therefore e.g. areConvertible("Jy", "Jy/microacsec2")==1. Numerically, "Jy" is the same as "Jy/sr2".
unit1 | (Gyoto::Units::Unit) first unit |
unit2 | (Gyoto::Units::Unit) second unit |
double Gyoto::Units::FromGeometrical | ( | double | value, |
const std::string & | unit, | ||
const Gyoto::SmartPointer< Gyoto::Metric::Generic > & | gg | ||
) |
Convert to arbitrary length unit from geometrical units.
Convert value to unit represented by "unit" from geometrical units.
value | (double) the value to convert, expressed in geometrical units. |
unit | (std::string) the "unit" to which to convert, e.g. "km", "sunradius" or "geometrical". More units are supported if Gyoto was compiled with udunits support. |
gg | (const Gyoto::SmartPointer<Gyoto::Metric::Generic> &) metric to interpret "geometrical". |
double Gyoto::Units::FromGeometricalTime | ( | double | value, |
const std::string & | unit, | ||
const Gyoto::SmartPointer< Gyoto::Metric::Generic > & | gg | ||
) |
Convert to arbitrary time unit from geometrical units.
value | (double) the value to convert, expressed in geometrical units. |
unit | (std::string) the "unit" to which to convert, e.g. "yr", "s" or "geometrical_time". More units are supported if Gyoto was compiled with udunits support. |
gg | (const Gyoto::SmartPointer<Gyoto::Metric::Generic> &) metric to interpret "geometrical_time". |
double Gyoto::Units::FromHerz | ( | double | value, |
const std::string & | unit | ||
) |
Convert to arbitrary frequency unit from Herz.
FromHerz will also convert to length and energy units (such as "eV").
value | (double) the value to convert, expressed according in "Hz". |
unit | (std::string) the "unit" from which to convert, e.g. "MHz", "keV" |
double Gyoto::Units::FromKilograms | ( | double | value, |
const std::string & | unit | ||
) |
Convert to arbitrary mass unit from kilograms.
Convert value from unit represented by "unit" from kilograms.
value | (double) the value to convert, expressed inkilograms. |
unit | (std::string) the "unit" to which to convert, e.g. "g", "kg" or "sunmass". More units are supported if Gyoto was compiled with udunits support. |
double Gyoto::Units::FromMeters | ( | double | value, |
const std::string & | unit, | ||
const Gyoto::SmartPointer< Gyoto::Metric::Generic > & | gg = NULL |
||
) |
Convert to arbitrary length unit from meters.
Convert value to unit represented by "unit" from meters.
If gg is provided (and not NULL), use it to interpret the string "geometrical" as representing gg->Gyoto::Metric::Generic::unitLength().
ToMeters() will also convert to time, frequency and energy units (as in wavelength -> frequency).
value | (double) the value to convert, expressed in meters. |
unit | (std::string) the "unit" to which to convert, e.g. "km", "sunradius" or "geometrical". More units are supported if Gyoto was compiled with udunits support. |
gg | (const Gyoto::SmartPointer<Gyoto::Metric::Generic> &, NULL if not specified) optional metric to interpret "geometrical". |
double Gyoto::Units::FromSeconds | ( | double | value, |
const std::string & | unit, | ||
const Gyoto::SmartPointer< Gyoto::Metric::Generic > & | gg = NULL |
||
) |
Convert to arbitrary time unit from seconds.
Convert value to unit represented by "unit" from seconds.
If gg is provided (and not NULL), use it to interpret the string "geometrical_time" as representing gg->Gyoto::Metric::Generic::unitLength()/GYOTO_C.
value | (double) the value to convert, expressed in seconds. |
unit | (std::string) the "unit" to which to convert, e.g. "s", "yr" or "geometrical_time". More units are supported if Gyoto was compiled with udunits support. |
gg | (const Gyoto::SmartPointer<Gyoto::Metric::Generic> &, NULL if not specified) optional metric to interpret "geometrical". |
void Gyoto::Units::Init | ( | ) |
double Gyoto::Units::ToGeometrical | ( | double | value, |
const std::string & | unit, | ||
const Gyoto::SmartPointer< Gyoto::Metric::Generic > & | gg | ||
) |
Convert from arbitrary length unit to geometrical units.
Convert value from unit represented by "unit" to geometrical units.
value | (double) the value to convert, expressed according to "unit". |
unit | (std::string) the "unit" from which to convert, e.g. "km", "sunradius" or "geometrical". More units are supported if Gyoto was compiled with udunits support. |
gg | (const Gyoto::SmartPointer<Gyoto::Metric::Generic> &) metric to interpret "geometrical". |
double Gyoto::Units::ToGeometricalTime | ( | double | value, |
const std::string & | unit, | ||
const Gyoto::SmartPointer< Gyoto::Metric::Generic > & | gg | ||
) |
Convert from arbitrary time unit to geometrical units.
value | (double) the value to convert, expressed according to "unit". |
unit | (std::string) the "unit" from which to convert, e.g. "s", "kyr" or "geometrical_time". More units are supported if Gyoto was compiled with udunits support. |
gg | (const Gyoto::SmartPointer<Gyoto::Metric::Generic> &) metric to interpret "geometrical_time". |
double Gyoto::Units::ToHerz | ( | double | value, |
const std::string & | unit | ||
) |
Convert from arbitrary frequency unit to Herz.
ToHerz will also convert from length and energy units (such as "eV").
value | (double) the value to convert, expressed according to "unit". |
unit | (std::string) the "unit" from which to convert, e.g. "MHz", "keV" |
double Gyoto::Units::ToKilograms | ( | double | value, |
const std::string & | unit | ||
) |
Convert from arbitrary mass unit to kilograms.
Convert value from unit represented by "unit" to kilograms.
value | (double) the value to convert, expressed according to "unit" |
unit | (std::string) the "unit" from which to convert, e.g. "g", "kg" or "sunmass". More units are supported if Gyoto was compiled with udunits support. |
double Gyoto::Units::ToMeters | ( | double | value, |
const std::string & | unit, | ||
const Gyoto::SmartPointer< Gyoto::Metric::Generic > & | gg = NULL |
||
) |
Convert from arbitrary length unit to meters.
Convert value from unit represented by "unit" to meters.
If gg is provided (and not NULL), use it to interpret the string "geometrical" as representing gg->Gyoto::Metric::Generic::unitLength().
ToMeters() will also convert time, frequency and energy units to meters (as in frequency -> wavelength).
value | (double) the value to convert, expressed according to "unit" |
unit | (std::string) the "unit" from which to convert, e.g. "km", "sunradius" or "geometrical". More units are supported if Gyoto was compiled with udunits support. |
gg | (const Gyoto::SmartPointer<Gyoto::Metric::Generic> &, NULL if not specified) optional metric to interpret "geometrical". |
double Gyoto::Units::ToSeconds | ( | double | value, |
const std::string & | unit, | ||
const Gyoto::SmartPointer< Gyoto::Metric::Generic > & | gg = NULL |
||
) |
Convert from arbitrary time unit to seconds.
Convert value from unit represented by "unit" to seconds.
If gg is provided (and not NULL), use it to interpret the string "geometrical_time" as representing gg->Gyoto::Metric::Generic::unitLength()/GYOTO_C.
value | (double) the value to convert, expressed according to "unit" |
unit | (std::string) the "unit" from which to convert, e.g. "s", "yr" or "geometrical_time". More units are supported if Gyoto was compiled with udunits support. |
gg | (const Gyoto::SmartPointer<Gyoto::Metric::Generic> &, NULL if not specified) optional metric to interpret "geometrical". |