81 #ifndef __GyotoConverters_H_ 82 #define __GyotoConverters_H_ 177 double ToMeters(
double value,
const std::string &unit,
203 double FromMeters(
double value,
const std::string &unit,
226 double ToSeconds(
double value,
const std::string &unit,
249 double FromSeconds(
double value,
const std::string &unit,
265 double ToKilograms(
double value,
const std::string & unit);
280 double FromKilograms(
double value,
const std::string & unit);
364 double ToHerz(
double value,
const std::string &unit);
379 double FromHerz(
double value,
const std::string &unit);
418 Unit(const std::string &unit);
428 Unit(char const * const unit);
445 double
To (double val, const Unit &from_unit);
455 double
From (double val, const Unit &to_unit);
462 operator std::string() const ;
469 operator ut_unit*() const ;
475 cv_converter * converter_;
479 Converter(const Gyoto::Units::Unit& from,
480 const Gyoto::Units::Unit& to);
486 void reset(const Gyoto::Units::Unit& from,
487 const Gyoto::Units::Unit& to);
503 double operator()(double value) const ;
bool areConvertible(const Unit &unit1, const Unit &unit2)
Is it possible to convert between unit1 and unit2?
double ToHerz(double value, const std::string &unit)
Convert from arbitrary frequency unit to Herz.
double FromMeters(double value, const std::string &unit, const Gyoto::SmartPointer< Gyoto::Metric::Generic > &gg=NULL)
Convert to arbitrary length unit from meters.
double FromGeometricalTime(double value, const std::string &unit, const Gyoto::SmartPointer< Gyoto::Metric::Generic > &gg)
Convert to arbitrary time unit from geometrical units.
Reference-counting pointers.
double ToMeters(double value, const std::string &unit, const Gyoto::SmartPointer< Gyoto::Metric::Generic > &gg=NULL)
Convert from arbitrary length unit to meters.
double FromKilograms(double value, const std::string &unit)
Convert to arbitrary mass unit from kilograms.
ut_system * getSystem()
Retrieve the unit system used in all of Gyoto.
Wrapper around ut_converter from udunits.
Definition: GyotoConverters.h:472
double FromHerz(double value, const std::string &unit)
Convert to arbitrary frequency unit from Herz.
double ToKilograms(double value, const std::string &unit)
Convert from arbitrary mass unit to kilograms.
double From(double val, const Unit &to_unit)
Convert from Unit.
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43
void Init()
Load and initialize all (non-context-sensitive) units.
ut_unit * unit_
the underlying ut_unit (from udunits)
Definition: GyotoConverters.h:407
double ToGeometrical(double value, const std::string &unit, const Gyoto::SmartPointer< Gyoto::Metric::Generic > &gg)
Convert from arbitrary length unit to geometrical units.
double ToGeometricalTime(double value, const std::string &unit, const Gyoto::SmartPointer< Gyoto::Metric::Generic > &gg)
Convert from arbitrary time unit to geometrical units.
Can be pointed to by a SmartPointer.
Definition: GyotoSmartPointer.h:80
double FromGeometrical(double value, const std::string &unit, const Gyoto::SmartPointer< Gyoto::Metric::Generic > &gg)
Convert to arbitrary length unit from geometrical units.
std::string kind_
the string used to instantiate this unit
Definition: GyotoConverters.h:408
double To(double val, const Unit &from_unit)
Convert to Unit.
double FromSeconds(double value, const std::string &unit, const Gyoto::SmartPointer< Gyoto::Metric::Generic > &gg=NULL)
Convert to arbitrary time unit from seconds.
Wrapper around ut_unit from udunits.
Definition: GyotoConverters.h:403
double ToSeconds(double value, const std::string &unit, const Gyoto::SmartPointer< Gyoto::Metric::Generic > &gg=NULL)
Convert from arbitrary time unit to seconds.