GEOS
Classes | Namespaces | Typedefs | Enumerations | Functions | Variables
Units.hpp File Reference

Enumerates the Units that are in use in GEOS and regroups useful conversion and formatting functions. More...

#include "common/DataTypes.hpp"
#include "common/PhysicsConstants.hpp"
#include "common/format/Format.hpp"

Go to the source code of this file.

Classes

struct  geos::units::TimeFormatInfo
 Stores information that is useful to duration strings. Based on the geos::units time constants. More...
 
struct  GEOS_FMT_NS::formatter< geos::units::TimeFormatInfo >
 Formatter to be able to directly use a DurationInfo as a GEOS_FMT() argument. More...
 

Namespaces

 geos
 

Typedefs

using geos::units::SystemClock = std::chrono::high_resolution_clock
 Clock in use in GEOS to manipulate system times.
 
using geos::units::YearDaysRatio = std::ratio< 146097, 400 >
 One year = 365.2425 days (= 146097 / 400) following the Gregorian calendar and the C++ convention.
 
using geos::units::Days = std::chrono::duration< int64_t, std::ratio_multiply< std::ratio< 24 >, std::chrono::hours::period > >
 Day helper duration type, equivalent to C++20 std::chrono::days.
 
using geos::units::Years = std::chrono::duration< int64_t, std::ratio_multiply< YearDaysRatio, Days::period > >
 Year helper duration type, equivalent to C++20 std::chrono::years.
 

Enumerations

enum  geos::units::Unit : integer {
  geos::units::Unknown , geos::units::Dimensionless , geos::units::Pressure , geos::units::Temperature ,
  geos::units::TemperatureInC , geos::units::Distance , geos::units::Time , geos::units::Viscosity ,
  geos::units::Density , geos::units::Enthalpy , geos::units::Solubility , geos::units::Mass ,
  geos::units::Mole , geos::units::MassRate , geos::units::MoleRate , geos::units::Transmissibility
}
 Enumerator of available unit types. Units are in SI by default. More...
 

Functions

constexpr GEOS_HOST_DEVICE double geos::units::convertKToC (double kelvin)
 
constexpr GEOS_HOST_DEVICE double geos::units::convertCToK (double celsius)
 
constexpr std::string_view geos::units::getDescription (Unit unit)
 
constexpr std::string_view geos::units::getSymbol (Unit unit)
 
string geos::units::formatValue (real64 value, Unit unit)
 Format the specified value coherently with the specified unit. More...
 

Variables

static constexpr double geos::units::YearDays = ( double )YearDaysRatio::num / YearDaysRatio::den
 Days in one year (following the Gregorian calendar and the C++ convention) = 365.2425 days (= 146097 / 400).
 
static constexpr double geos::units::MinuteSeconds = 60.0
 Seconds in a minute.
 
static constexpr double geos::units::HourSeconds = 60.0 * MinuteSeconds
 Seconds in a hour.
 
static constexpr double geos::units::DaySeconds = 24.0 * HourSeconds
 Seconds in a day.
 
static constexpr double geos::units::YearSeconds = YearDays * DaySeconds
 Seconds in a year.
 

Detailed Description

Enumerates the Units that are in use in GEOS and regroups useful conversion and formatting functions.

Definition in file Units.hpp.

Enumeration Type Documentation

◆ Unit

enum geos::units::Unit : integer

Enumerator of available unit types. Units are in SI by default.

Enumerator
Unknown 

Default label when a unit is not known for a value.

Dimensionless 

Label to use when a value has not physical dimension (ratio values, propotions...)

Pressure 

Pressure in Pascal.

Temperature 

Temperature in Kelvin.

TemperatureInC 

Temperature in Celcius.

Distance 

Distance in meter.

Time 

Time in seconds.

Viscosity 

Viscosity in Pa*s.

Density 

Density in kg/m³

Enthalpy 

Enthalpy in J/kg.

Solubility 

Solubility in g/L.

Mass 

Mass in kg.

Mole 

Mole in mol.

MassRate 

Mass rate in kg/s.

MoleRate 

Mole rate in mol/s.

Transmissibility 

Transmissibility in m2/s.

Definition at line 53 of file Units.hpp.

Function Documentation

◆ convertCToK()

constexpr GEOS_HOST_DEVICE double geos::units::convertCToK ( double  celsius)
inlineconstexpr
Returns
the input Celsius degrees converted in Kelvin
Parameters
celsiusdegrees input

Definition at line 46 of file Units.hpp.

◆ convertKToC()

constexpr GEOS_HOST_DEVICE double geos::units::convertKToC ( double  kelvin)
inlineconstexpr
Returns
the input Kelvin degrees converted in Celsius
Parameters
kelvindegrees input

Definition at line 39 of file Units.hpp.

◆ formatValue()

string geos::units::formatValue ( real64  value,
Unit  unit 
)
inline

Format the specified value coherently with the specified unit.

Parameters
valueThe value to format.
unitThe unit of the specified value.
Returns
A string that can be easily be integrated in a sentence and takes the form "characteristic" of "value" ["unit symbol"]

Definition at line 166 of file Units.hpp.

◆ getDescription()

constexpr std::string_view geos::units::getDescription ( Unit  unit)
inlineconstexpr
Parameters
unitThe unit we want the information.
Returns
The name of the specified unit followed by its symbol in brackets.

Definition at line 109 of file Units.hpp.

◆ getSymbol()

constexpr std::string_view geos::units::getSymbol ( Unit  unit)
inlineconstexpr
Parameters
unitThe unit we want the information.
Returns
The symbol of the specified unit.

Definition at line 136 of file Units.hpp.