19 #ifndef GEOS_MATH_UNITS_HPP_
20 #define GEOS_MATH_UNITS_HPP_
38 {
return kelvin - constants::zeroDegreesCelsiusInKelvin; }
45 {
return celsius + constants::zeroDegreesCelsiusInKelvin; }
96 default:
return "unknown [?]";
98 case Pressure:
return "pressure [Pa]";
101 case Distance:
return "distance [m]";
102 case Time:
return "time [s]";
103 case Viscosity:
return "viscosity [Pa*s]";
104 case Enthalpy:
return "enthalpy [J/kg]";
105 case Density:
return "density [kg/m3]";
124 case Time:
return "s";
139 default:
return GEOS_FMT(
"value of {} [?]", value );
140 case Dimensionless:
return GEOS_FMT(
"value of {} [1]", value );
141 case Pressure:
return GEOS_FMT(
"pressure of {} [Pa]", value );
142 case Temperature:
return GEOS_FMT(
"temperature of {} [K]", value );
144 case Distance:
return GEOS_FMT(
"distance of {} [s]", value );
145 case Time:
return GEOS_FMT(
"time of {} [s]", value );
156 using Days = std::chrono::duration< int64_t, std::ratio_multiply< std::ratio< 24 >, std::chrono::hours::period > >;
158 using Years = std::chrono::duration< int64_t, std::ratio_multiply< YearDaysRatio, Days::period > >;
161 static constexpr
double YearDays = ( double )YearDaysRatio::num / YearDaysRatio::den;
200 TimeFormatInfo(
double totalSeconds,
int years,
int days,
int hours,
int minutes,
int seconds );
234 struct GEOS_FMT_NS::formatter<
geos::units::TimeFormatInfo > : GEOS_FMT_NS::formatter< std::string >
244 return GEOS_FMT_NS::formatter< std::string >::format( durationData.
toString(), ctx );
#define GEOS_HOST_DEVICE
Marks a host-device function.
Regroups useful constants that are globally used for math and physics computations.
constexpr GEOS_HOST_DEVICE double convertCToK(double celsius)
std::chrono::duration< int64_t, std::ratio_multiply< YearDaysRatio, Days::period > > Years
Year helper duration type, equivalent to C++20 std::chrono::years.
std::ratio< 146097, 400 > YearDaysRatio
One year = 365.2425 days (= 146097 / 400) following the Gregorian calendar and the C++ convention.
constexpr std::string_view getDescription(Unit unit)
static constexpr double YearSeconds
Seconds in a year.
constexpr GEOS_HOST_DEVICE double convertKToC(double kelvin)
std::chrono::system_clock SystemClock
Clock in use in GEOS to manipulate system times.
Unit
Enumerator of available unit types. Units are in SI by default.
@ Distance
Distance in meter.
@ Density
Density in kg/m³
@ TemperatureInC
Temperature in Celcius.
@ Viscosity
Viscosity in Pa*s.
@ Solubility
Solubility in g/L.
@ Pressure
Pressure in Pascal.
@ Enthalpy
Enthalpy in J/kg.
@ Dimensionless
Label to use when a value has not physical dimension (ratio values, propotions...)
@ Temperature
Temperature in Kelvin.
@ Unknown
Default label when a unit is not known for a value.
static constexpr double HourSeconds
Seconds in a hour.
static constexpr double MinuteSeconds
Seconds in a minute.
static constexpr double DaySeconds
Seconds in a day.
constexpr std::string_view getSymbol(Unit unit)
static constexpr double YearDays
Days in one year (following the Gregorian calendar and the C++ convention) = 365.2425 days (= 146097 ...
string formatValue(real64 value, Unit unit)
Format the specified value coherently with the specified unit.
std::chrono::duration< int64_t, std::ratio_multiply< std::ratio< 24 >, std::chrono::hours::period > > Days
Day helper duration type, equivalent to C++20 std::chrono::days.
double real64
64-bit floating point type.
std::int32_t integer
Signed integer type.
std::string_view string_view
String type.