From 24214b1a438d0431d1333cced0028395596863a7 Mon Sep 17 00:00:00 2001 From: MarkosTh09 Date: Thu, 9 Nov 2023 13:33:34 +0400 Subject: [PATCH] add cgs system of units --- core/src/units/builtin.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/core/src/units/builtin.rs b/core/src/units/builtin.rs index 25444c25..e95bf3a0 100644 --- a/core/src/units/builtin.rs +++ b/core/src/units/builtin.rs @@ -504,6 +504,24 @@ const COMMON_PHYSICAL_UNITS: &[UnitTuple] = &[ ("light", "", "c", ""), ]; +const CGS_UNITS: &[UnitTuple] = &[ + ("gal", "gals", "cm/s^2", ""), + ("dyne", "dynes", "g*gal", ""), + ("erg", "ergs", "g*cm^2/s^2", ""), + ("barye", "baryes", "g/(cm*s^2)", ""), + ("poise", "poises", "g/(cm*s)", ""), + ("stokes", "", "cm^2/s", ""), + ("kayser", "kaysers", "cm^-1", ""), +]; + +const CGS_ABBREVATIONS: &[UnitTuple] = &[ + ("dyn", "dyns", "dyne", ""), + ("Ba", "", "barye", ""), + ("P", "", "poise", ""), + ("St", "", "", ""), + ("K", "", "kayser", ""), +]; + const IMPERIAL_UNITS: &[UnitTuple] = &[ ("inch", "inches", "2.54 cm", ""), ("mil", "mils", "1/1000 inch", ""), @@ -703,6 +721,8 @@ pub(crate) const ALL_UNIT_DEFS: &[&[UnitTuple]] = &[ IMPERIAL_ABBREVIATIONS, NAUTICAL_UNITS, CURRENCIES, + CGS_UNITS, + CGS_ABBREVATIONS, ]; const SHORT_PREFIXES: &[(&str, &str)] = &[