Skip to content

Commit

Permalink
feat: unit constants for all units
Browse files Browse the repository at this point in the history
  • Loading branch information
JohelEGP committed Dec 25, 2020
1 parent aa72843 commit d98ff74
Show file tree
Hide file tree
Showing 71 changed files with 890 additions and 18 deletions.
18 changes: 18 additions & 0 deletions src/include/units/data/base/information.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,22 @@ constexpr auto operator"" _q_PiB(unsigned long long l) { return information<pebi

} // namespace literals

inline namespace unit_constants {

inline constexpr auto b = information<bit, detail::one_rep>{};
inline constexpr auto Kib = information<kibibit, detail::one_rep>{};
inline constexpr auto Mib = information<mebibit, detail::one_rep>{};
inline constexpr auto Gib = information<gibibit, detail::one_rep>{};
inline constexpr auto Tib = information<tebibit, detail::one_rep>{};
inline constexpr auto Pib = information<pebibit, detail::one_rep>{};

inline constexpr auto B = information<byte, detail::one_rep>{};
inline constexpr auto KiB = information<kibibyte, detail::one_rep>{};
inline constexpr auto MiB = information<mebibyte, detail::one_rep>{};
inline constexpr auto GiB = information<gibibyte, detail::one_rep>{};
inline constexpr auto TiB = information<tebibyte, detail::one_rep>{};
inline constexpr auto PiB = information<pebibyte, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::data
11 changes: 11 additions & 0 deletions src/include/units/data/derived/bitrate.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,15 @@ constexpr auto operator"" _q_Pib_per_s(unsigned long long l) { return bitrate<pe

} // namespace literals

inline namespace unit_constants {

inline constexpr auto b_per_s = bitrate<bit_per_second, detail::one_rep>{};
inline constexpr auto Kib_per_s = bitrate<kibibit_per_second, detail::one_rep>{};
inline constexpr auto Mib_per_s = bitrate<mebibit_per_second, detail::one_rep>{};
inline constexpr auto Gib_per_s = bitrate<gibibit_per_second, detail::one_rep>{};
inline constexpr auto Tib_per_s = bitrate<tebibit_per_second, detail::one_rep>{};
inline constexpr auto Pib_per_s = bitrate<pebibit_per_second, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::data
6 changes: 6 additions & 0 deletions src/include/units/physical/si/base/amount_of_substance.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,10 @@ constexpr auto operator"" _q_mol(long double l) { return amount_of_substance<mol

} // namespace literals

inline namespace unit_constants {

inline constexpr auto mol = amount_of_substance<mole, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::physical::si
26 changes: 26 additions & 0 deletions src/include/units/physical/si/base/electric_current.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,30 @@ constexpr auto operator"" _q_YA(long double l) { return electric_current<yottaam

} // namespace literals

inline namespace unit_constants {

inline constexpr auto A = electric_current<ampere, detail::one_rep>{};
inline constexpr auto yA = electric_current<yoctoampere, detail::one_rep>{};
inline constexpr auto zA = electric_current<zeptoampere, detail::one_rep>{};
inline constexpr auto aA = electric_current<attoampere, detail::one_rep>{};
inline constexpr auto fA = electric_current<femtoampere, detail::one_rep>{};
inline constexpr auto pA = electric_current<picoampere, detail::one_rep>{};
inline constexpr auto nA = electric_current<nanoampere, detail::one_rep>{};
inline constexpr auto uA = electric_current<microampere, detail::one_rep>{};
inline constexpr auto mA = electric_current<milliampere, detail::one_rep>{};
inline constexpr auto cA = electric_current<centiampere, detail::one_rep>{};
inline constexpr auto dA = electric_current<deciampere, detail::one_rep>{};
inline constexpr auto daA = electric_current<decaampere, detail::one_rep>{};
inline constexpr auto hA = electric_current<hectoampere, detail::one_rep>{};
inline constexpr auto kA = electric_current<kiloampere, detail::one_rep>{};
inline constexpr auto MA = electric_current<megaampere, detail::one_rep>{};
inline constexpr auto GA = electric_current<gigaampere, detail::one_rep>{};
inline constexpr auto TA = electric_current<teraampere, detail::one_rep>{};
inline constexpr auto PA = electric_current<petaampere, detail::one_rep>{};
inline constexpr auto EA = electric_current<exaampere, detail::one_rep>{};
inline constexpr auto ZA = electric_current<zettaampere, detail::one_rep>{};
inline constexpr auto YA = electric_current<yottaampere, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::physical::si
26 changes: 26 additions & 0 deletions src/include/units/physical/si/base/luminous_intensity.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,30 @@ constexpr auto operator"" _q_Ycd(long double l) { return luminous_intensity<yott

} // namespace literals

inline namespace unit_constants {

inline constexpr auto cd = luminous_intensity<candela, detail::one_rep>{};
inline constexpr auto ycd = luminous_intensity<yoctocandela, detail::one_rep>{};
inline constexpr auto zcd = luminous_intensity<zeptocandela, detail::one_rep>{};
inline constexpr auto acd = luminous_intensity<attocandela, detail::one_rep>{};
inline constexpr auto fcd = luminous_intensity<femtocandela, detail::one_rep>{};
inline constexpr auto pcd = luminous_intensity<picocandela, detail::one_rep>{};
inline constexpr auto ncd = luminous_intensity<nanocandela, detail::one_rep>{};
inline constexpr auto ucd = luminous_intensity<microcandela, detail::one_rep>{};
inline constexpr auto mcd = luminous_intensity<millicandela, detail::one_rep>{};
inline constexpr auto ccd = luminous_intensity<centicandela, detail::one_rep>{};
inline constexpr auto dcd = luminous_intensity<decicandela, detail::one_rep>{};
inline constexpr auto dacd = luminous_intensity<decacandela, detail::one_rep>{};
inline constexpr auto hcd = luminous_intensity<hectocandela, detail::one_rep>{};
inline constexpr auto kcd = luminous_intensity<kilocandela, detail::one_rep>{};
inline constexpr auto Mcd = luminous_intensity<megacandela, detail::one_rep>{};
inline constexpr auto Gcd = luminous_intensity<gigacandela, detail::one_rep>{};
inline constexpr auto Tcd = luminous_intensity<teracandela, detail::one_rep>{};
inline constexpr auto Pcd = luminous_intensity<petacandela, detail::one_rep>{};
inline constexpr auto Ecd = luminous_intensity<exacandela, detail::one_rep>{};
inline constexpr auto Zcd = luminous_intensity<zettacandela, detail::one_rep>{};
inline constexpr auto Ycd = luminous_intensity<yottacandela, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::physical::si
48 changes: 48 additions & 0 deletions src/include/units/physical/si/base/mass.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,52 @@ constexpr auto operator"" _q_Da(long double l) { return mass<dalton, long double

} // namespace literals

inline namespace unit_constants {

inline constexpr auto g = mass<gram, detail::one_rep>{};
inline constexpr auto yg = mass<yoctogram, detail::one_rep>{};
inline constexpr auto zg = mass<zeptogram, detail::one_rep>{};
inline constexpr auto ag = mass<attogram, detail::one_rep>{};
inline constexpr auto fg = mass<femtogram, detail::one_rep>{};
inline constexpr auto pg = mass<picogram, detail::one_rep>{};
inline constexpr auto ng = mass<nanogram, detail::one_rep>{};
inline constexpr auto ug = mass<microgram, detail::one_rep>{};
inline constexpr auto mg = mass<milligram, detail::one_rep>{};
inline constexpr auto cg = mass<centigram, detail::one_rep>{};
inline constexpr auto dg = mass<decigram, detail::one_rep>{};
inline constexpr auto dag = mass<decagram, detail::one_rep>{};
inline constexpr auto hg = mass<hectogram, detail::one_rep>{};
inline constexpr auto kg = mass<kilogram, detail::one_rep>{};
inline constexpr auto Mg = mass<megagram, detail::one_rep>{};
inline constexpr auto Gg = mass<gigagram, detail::one_rep>{};
inline constexpr auto Tg = mass<teragram, detail::one_rep>{};
inline constexpr auto Pg = mass<petagram, detail::one_rep>{};
inline constexpr auto Eg = mass<exagram, detail::one_rep>{};
inline constexpr auto Zg = mass<zettagram, detail::one_rep>{};
inline constexpr auto Yg = mass<yottagram, detail::one_rep>{};
inline constexpr auto t = mass<tonne, detail::one_rep>{};
inline constexpr auto yt = mass<yoctotonne, detail::one_rep>{};
inline constexpr auto zt = mass<zeptotonne, detail::one_rep>{};
inline constexpr auto at = mass<attotonne, detail::one_rep>{};
inline constexpr auto ft = mass<femtotonne, detail::one_rep>{};
inline constexpr auto pt = mass<picotonne, detail::one_rep>{};
inline constexpr auto nt = mass<nanotonne, detail::one_rep>{};
inline constexpr auto ut = mass<microtonne, detail::one_rep>{};
inline constexpr auto mt = mass<millitonne, detail::one_rep>{};
inline constexpr auto ct = mass<centitonne, detail::one_rep>{};
inline constexpr auto dt = mass<decitonne, detail::one_rep>{};
inline constexpr auto dat = mass<decatonne, detail::one_rep>{};
inline constexpr auto ht = mass<hectotonne, detail::one_rep>{};
inline constexpr auto kt = mass<kilotonne, detail::one_rep>{};
inline constexpr auto Mt = mass<megatonne, detail::one_rep>{};
inline constexpr auto Gt = mass<gigatonne, detail::one_rep>{};
inline constexpr auto Tt = mass<teratonne, detail::one_rep>{};
inline constexpr auto Pt = mass<petatonne, detail::one_rep>{};
inline constexpr auto Et = mass<exatonne, detail::one_rep>{};
inline constexpr auto Zt = mass<zettatonne, detail::one_rep>{};
inline constexpr auto Yt = mass<yottatonne, detail::one_rep>{};
inline constexpr auto Da = mass<dalton, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::physical::si
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,10 @@ constexpr auto operator"" _q_K(long double l) { return thermodynamic_temperature

} // namespace literals

inline namespace unit_constants {

inline constexpr auto K = thermodynamic_temperature<kelvin, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::physical::si
8 changes: 7 additions & 1 deletion src/include/units/physical/si/cgs/base/length.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ inline namespace literals {
constexpr auto operator"" _q_cm(unsigned long long l) { return length<centimetre, std::int64_t>(l); }
constexpr auto operator"" _q_cm(long double l) { return length<centimetre, long double>(l); }

}
} // namespace literals

inline namespace unit_constants {

inline constexpr auto cm = length<centimetre, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::physical::si::cgs
8 changes: 7 additions & 1 deletion src/include/units/physical/si/cgs/base/mass.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ inline namespace literals {
constexpr auto operator"" _q_g(unsigned long long l) { return mass<gram, std::int64_t>(l); }
constexpr auto operator"" _q_g(long double l) { return mass<gram, long double>(l); }

}
} // namespace literals

inline namespace unit_constants {

inline constexpr auto g = mass<gram, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::physical::si::cgs
8 changes: 7 additions & 1 deletion src/include/units/physical/si/cgs/base/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ inline namespace literals {

using si::literals::operator"" _q_s;

}
} // namespace literals

inline namespace unit_constants {

using si::unit_constants::s;

} // namespace unit_constants

} // namespace units::physical::si::cgs
6 changes: 6 additions & 0 deletions src/include/units/physical/si/cgs/derived/acceleration.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,10 @@ constexpr auto operator"" _q_Gal(long double l) { return acceleration<gal, long

} // namespace literals

inline namespace unit_constants {

inline constexpr auto Gal = acceleration<gal, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::physical::si::cgs
8 changes: 7 additions & 1 deletion src/include/units/physical/si/cgs/derived/area.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ inline namespace literals {
constexpr auto operator"" _q_cm2(unsigned long long l) { return area<square_centimetre, std::int64_t>(l); }
constexpr auto operator"" _q_cm2(long double l) { return area<square_centimetre, long double>(l); }

}
} // namespace literals

inline namespace unit_constants {

inline constexpr auto cm2 = area<square_centimetre, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::physical::si::cgs
6 changes: 6 additions & 0 deletions src/include/units/physical/si/cgs/derived/energy.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,10 @@ constexpr auto operator"" _q_erg(long double l) { return energy<erg, long double

} // namespace literals

inline namespace unit_constants {

inline constexpr auto erg = energy<erg, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::physical::si::cgs
6 changes: 6 additions & 0 deletions src/include/units/physical/si/cgs/derived/force.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,10 @@ constexpr auto operator"" _q_dyn(long double l) { return force<dyne, long double

} // namespace literals

inline namespace unit_constants {

inline constexpr auto dyn = force<dyne, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::physical::si::cgs
6 changes: 6 additions & 0 deletions src/include/units/physical/si/cgs/derived/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,10 @@ constexpr auto operator"" _q_erg_per_s(long double l) { return power<erg_per_sec

} // namespace literals

inline namespace unit_constants {

inline constexpr auto erg_per_s = power<erg_per_second, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::physical::si::cgs
6 changes: 6 additions & 0 deletions src/include/units/physical/si/cgs/derived/pressure.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,10 @@ constexpr auto operator"" _q_Ba(long double l) { return pressure<barye, long dou

} // namespace literals

inline namespace unit_constants {

inline constexpr auto Ba = pressure<barye, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::physical::si::cgs
6 changes: 6 additions & 0 deletions src/include/units/physical/si/cgs/derived/speed.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,10 @@ constexpr auto operator"" _q_cm_per_s(long double l) { return speed<centimetre_p

} // namespace literals

inline namespace unit_constants {

inline constexpr auto cm_per_s = speed<centimetre_per_second, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::physical::si::cgs
26 changes: 26 additions & 0 deletions src/include/units/physical/si/derived/absorbed_dose.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,30 @@ constexpr auto operator"" _q_YGy(long double l) { return absorbed_dose<yottagray

} // namespace literals

inline namespace unit_constants {

inline constexpr auto G = absorbed_dose<gray, detail::one_rep>{};
inline constexpr auto yGy = absorbed_dose<yoctogray, detail::one_rep>{};
inline constexpr auto zGy = absorbed_dose<zeptogray, detail::one_rep>{};
inline constexpr auto aGy = absorbed_dose<attogray, detail::one_rep>{};
inline constexpr auto fGy = absorbed_dose<femtogray, detail::one_rep>{};
inline constexpr auto pGy = absorbed_dose<picogray, detail::one_rep>{};
inline constexpr auto nGy = absorbed_dose<nanogray, detail::one_rep>{};
inline constexpr auto uGy = absorbed_dose<microgray, detail::one_rep>{};
inline constexpr auto mGy = absorbed_dose<milligray, detail::one_rep>{};
inline constexpr auto cGy = absorbed_dose<centigray, detail::one_rep>{};
inline constexpr auto dGy = absorbed_dose<decigray, detail::one_rep>{};
inline constexpr auto daGy = absorbed_dose<decagray, detail::one_rep>{};
inline constexpr auto hGy = absorbed_dose<hectogray, detail::one_rep>{};
inline constexpr auto kGy = absorbed_dose<kilogray, detail::one_rep>{};
inline constexpr auto MGy = absorbed_dose<megagray, detail::one_rep>{};
inline constexpr auto GGy = absorbed_dose<gigagray, detail::one_rep>{};
inline constexpr auto TGy = absorbed_dose<teragray, detail::one_rep>{};
inline constexpr auto PGy = absorbed_dose<petagray, detail::one_rep>{};
inline constexpr auto EGy = absorbed_dose<exagray, detail::one_rep>{};
inline constexpr auto ZGy = absorbed_dose<zettagray, detail::one_rep>{};
inline constexpr auto YGy = absorbed_dose<yottagray, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::physical::si
6 changes: 6 additions & 0 deletions src/include/units/physical/si/derived/acceleration.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,10 @@ constexpr auto operator"" _q_m_per_s2(long double l) { return acceleration<metre

} // namespace literals

inline namespace unit_constants {

inline constexpr auto mps2 = acceleration<metre_per_second_sq, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::physical::si
7 changes: 6 additions & 1 deletion src/include/units/physical/si/derived/angular_velocity.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ inline namespace literals {
constexpr auto operator"" _q_rad_per_s(unsigned long long l) { return angular_velocity<radian_per_second, std::int64_t>(l); }
constexpr auto operator"" _q_rad_per_s(long double l) { return angular_velocity<radian_per_second, long double>(l); }


} // namespace literals

inline namespace unit_constants {

inline constexpr auto rad_per_s = angular_velocity<radian_per_second, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::physical::si
26 changes: 26 additions & 0 deletions src/include/units/physical/si/derived/capacitance.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,30 @@ constexpr auto operator"" _q_YF(long double l) { return capacitance<yottafarad,

} // namespace literals

inline namespace unit_constants {

inline constexpr auto F = capacitance<farad, detail::one_rep>{};
inline constexpr auto yF = capacitance<yoctofarad, detail::one_rep>{};
inline constexpr auto zF = capacitance<zeptofarad, detail::one_rep>{};
inline constexpr auto aF = capacitance<attofarad, detail::one_rep>{};
inline constexpr auto fF = capacitance<femtofarad, detail::one_rep>{};
inline constexpr auto pF = capacitance<picofarad, detail::one_rep>{};
inline constexpr auto nF = capacitance<nanofarad, detail::one_rep>{};
inline constexpr auto uF = capacitance<microfarad, detail::one_rep>{};
inline constexpr auto mF = capacitance<millifarad, detail::one_rep>{};
inline constexpr auto cF = capacitance<centifarad, detail::one_rep>{};
inline constexpr auto dF = capacitance<decifarad, detail::one_rep>{};
inline constexpr auto daF = capacitance<decafarad, detail::one_rep>{};
inline constexpr auto hF = capacitance<hectofarad, detail::one_rep>{};
inline constexpr auto kF = capacitance<kilofarad, detail::one_rep>{};
inline constexpr auto MF = capacitance<megafarad, detail::one_rep>{};
inline constexpr auto GF = capacitance<gigafarad, detail::one_rep>{};
inline constexpr auto TF = capacitance<terafarad, detail::one_rep>{};
inline constexpr auto PF = capacitance<petafarad, detail::one_rep>{};
inline constexpr auto EF = capacitance<exafarad, detail::one_rep>{};
inline constexpr auto ZF = capacitance<zettafarad, detail::one_rep>{};
inline constexpr auto YF = capacitance<yottafarad, detail::one_rep>{};

} // namespace unit_constants

} // namespace units::physical::si
Loading

0 comments on commit d98ff74

Please sign in to comment.