Reaktoro 
A unified framework for modeling chemically reactive systems
ConvertUtils.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright (C) 2014-2015 Allan Leal
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18 #pragma once
19 
20 namespace Reaktoro {
21 
23 template<typename Scalar> auto convertCelsiusToKelvin(Scalar T) -> decltype(T + 273.15) { return T + 273.15; }
24 
26 template<typename Scalar> auto convertKelvinToCelsius(Scalar T) -> decltype(T - 273.15) { return T - 273.15; }
27 
29 template<typename Scalar> auto convertPascalToKiloPascal(Scalar P) -> decltype(P * 1.0e-3) { return P * 1.0e-3; }
30 
32 template<typename Scalar> auto convertPascalToMegaPascal(Scalar P) -> decltype(P * 1.0e-6) { return P * 1.0e-6; }
33 
35 template<typename Scalar> auto convertPascalToBar(Scalar P) -> decltype(P * 1.0e-5) { return P * 1.0e-5; }
36 
38 template<typename Scalar> auto convertKiloPascalToPascal(Scalar P) -> decltype(P * 1.0e+3) { return P * 1.0e+3; }
39 
41 template<typename Scalar> auto convertKiloPascalToMegaPascal(Scalar P) -> decltype(P * 1.0e-3) { return P * 1.0e-3; }
42 
44 template<typename Scalar> auto convertKiloPascalToBar(Scalar P) -> decltype(P * 1.0e-2) { return P * 1.0e-2; }
45 
47 template<typename Scalar> auto convertMegaPascalToPascal(Scalar P) -> decltype(P * 1.0e+6) { return P * 1.0e+6; }
48 
50 template<typename Scalar> auto convertMegaPascalToKiloPascal(Scalar P) -> decltype(P * 1.0e+3) { return P * 1.0e+3; }
51 
53 template<typename Scalar> auto convertMegaPascalToBar(Scalar P) -> decltype(P * 1.0e+1) { return P * 1.0e+1; }
54 
56 template<typename Scalar> auto convertBarToPascal(Scalar P) -> decltype(P * 1.0e+5) { return P * 1.0e+5; }
57 
59 template<typename Scalar> auto convertBarToKiloPascal(Scalar P) -> decltype(P * 1.0e+2) { return P * 1.0e+2; }
60 
62 template<typename Scalar> auto convertBarToMegaPascal(Scalar P) -> decltype(P * 1.0e-1) { return P * 1.0e-1; }
63 
65 template<typename Scalar> auto convertBarToAtm(Scalar P) -> decltype(P * 0.986923267) { return P * 0.986923267; }
66 
68 template<typename Scalar> auto convertCubicCentimeterToCubicMeter(Scalar V) -> decltype(V * 1.0e-6) { return V * 1.0e-6; }
69 
71 template<typename Scalar> auto convertCubicMeterToCubicCentimeter(Scalar V) -> decltype(V * 1.0e+6) { return V * 1.0e+6; }
72 
74 template<typename Scalar> auto convertCubicMeterToLiter(Scalar V) -> decltype(V * 1.0e+3) { return V * 1.0e+3; }
75 
77 template<typename Scalar> auto convertLiterToCubicMeter(Scalar V) -> decltype(V * 1.0e-3) { return V * 1.0e-3; }
78 
79 } // namespace Reaktoro
auto convertCubicMeterToCubicCentimeter(Scalar V) -> decltype(V *1.0e+6)
Converts volume from m3 to cm3.
Definition: ConvertUtils.hpp:71
auto convertMegaPascalToBar(Scalar P) -> decltype(P *1.0e+1)
Converts pressure from mega pascal to bar.
Definition: ConvertUtils.hpp:53
auto convertMegaPascalToKiloPascal(Scalar P) -> decltype(P *1.0e+3)
Converts pressure from mega pascal to kilo pascal.
Definition: ConvertUtils.hpp:50
auto convertCelsiusToKelvin(Scalar T) -> decltype(T+273.15)
Converts temperature from celsius to kelvin.
Definition: ConvertUtils.hpp:23
auto convertBarToPascal(Scalar P) -> decltype(P *1.0e+5)
Converts pressure from bar to pascal.
Definition: ConvertUtils.hpp:56
auto convertCubicCentimeterToCubicMeter(Scalar V) -> decltype(V *1.0e-6)
Converts volume from cm3 to m3.
Definition: ConvertUtils.hpp:68
auto convertLiterToCubicMeter(Scalar V) -> decltype(V *1.0e-3)
Converts volume from liter to m3.
Definition: ConvertUtils.hpp:77
auto convertPascalToMegaPascal(Scalar P) -> decltype(P *1.0e-6)
Converts pressure from pascal to mega pascal.
Definition: ConvertUtils.hpp:32
auto convertBarToKiloPascal(Scalar P) -> decltype(P *1.0e+2)
Converts pressure from bar to kilo pascal.
Definition: ConvertUtils.hpp:59
auto convertKelvinToCelsius(Scalar T) -> decltype(T-273.15)
Converts temperature from kelvin to celsius.
Definition: ConvertUtils.hpp:26
auto convertCubicMeterToLiter(Scalar V) -> decltype(V *1.0e+3)
Converts volume from m3 to liter.
Definition: ConvertUtils.hpp:74
auto convertPascalToKiloPascal(Scalar P) -> decltype(P *1.0e-3)
Converts pressure from pascal to kilo pascal.
Definition: ConvertUtils.hpp:29
auto convertKiloPascalToPascal(Scalar P) -> decltype(P *1.0e+3)
Converts pressure from kilo pascal to pascal.
Definition: ConvertUtils.hpp:38
auto convertBarToAtm(Scalar P) -> decltype(P *0.986923267)
Convert pressure from bar to atm.
Definition: ConvertUtils.hpp:65
auto convertMegaPascalToPascal(Scalar P) -> decltype(P *1.0e+6)
Converts pressure from mega pascal to pascal.
Definition: ConvertUtils.hpp:47
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
auto convertBarToMegaPascal(Scalar P) -> decltype(P *1.0e-1)
Converts pressure from bar to mega pascal.
Definition: ConvertUtils.hpp:62
auto convertKiloPascalToBar(Scalar P) -> decltype(P *1.0e-2)
Converts pressure from kilo pascal to bar.
Definition: ConvertUtils.hpp:44
auto convertKiloPascalToMegaPascal(Scalar P) -> decltype(P *1.0e-3)
Converts pressure from kilo pascal to mega pascal.
Definition: ConvertUtils.hpp:41
auto convertPascalToBar(Scalar P) -> decltype(P *1.0e-5)
Converts pressure from pascal to bar.
Definition: ConvertUtils.hpp:35