The dimension is represented as a single unsigned integer and each basic SI unit dimension exponent "occupies" 5 bits, i.e. the range for the exponent is -16..15. The system is based on the modular arithmetics so to calculate the result of the multiplication the two integers representing dimension simply need to be added, thus making operations on parameters with units extremely fast.
More...
|
static uint | Denominator (uint dim) |
| Returns only the denominator units For example passing a uint representing J/kg will return kg More...
|
|
static uint | Flip (uint dim) |
| Calculates 1/dim More...
|
|
static uint | FromMLT (int kg, int m, int s, int c=0) |
| Converts from natural units to a single integer that represents the dimension. int –> uint 0 –> 0 1 –> 1 ... 15 –> 15 -16 –> 16 -15 –> 17 -14 –> 18 -13 –> 19 -12 –> 20 -11 –> 21 -10 –> 22 -9 –> 23 -8 –> 24 -7 –> 25 -6 –> 26 -5 –> 27 -4 –> 28 -3 –> 29 -2 –> 30 -1 –> 31 More...
|
|
static uint | FromString (string p) |
|
static uint | Minus (uint a, uint b) |
| Calculates the result of subtraction of dimensions. To be used to calculate the resulting dimension of dividing of two quantities More...
|
|
static uint | Numerator (uint dim) |
| Returns only the numerator units For example passing a uint representing J/kg will return J More...
|
|
static uint | Plus (uint a, uint b) |
| Calculates the result of sum of dimensions. To be used to calculate the resulting dimension of multiplication of two quantities More...
|
|
static uint | Times (uint a, int factor) |
| Calculates the result of multiplying dimensions by an integer, to be used to calculate the dimension of the power operation More...
|
|
static void | ToMLT (uint dim, out int kg, out int m, out int s, out int c) |
|
static string | ToMLTh (uint dim) |
| Human readable dimensions string More...
|
|
static string | ToMLTUnith (uint dim) |
| Human readable SI unit expression More...
|
|
|
static uint | CURRENCY = DimensionUtils.FromMLT(0, 0, 0, 1) |
|
static uint | EI = DimensionUtils.FromMLT(0, 1, -1) |
|
static uint | ENERGY = DimensionUtils.FromMLT(1, 2, -2) |
|
static uint | FECONOMY = DimensionUtils.FromMLT(0, -2, 0) |
|
static uint | HVM = DimensionUtils.FromMLT(0, 2, -2) |
|
static uint | HVV = DimensionUtils.FromMLT(1, -1, -2) |
|
static uint | LENGTH = DimensionUtils.FromMLT(0, 1, 0) |
|
static uint | MASS = DimensionUtils.FromMLT(1, 0, 0) |
|
static uint | RATIO = DimensionUtils.FromMLT(0, 0, 0) |
|
static uint | VENERGY = DimensionUtils.FromMLT(1, 1, -2) |
|
static uint | VOLUME = DimensionUtils.FromMLT(0, 3, 0) |
|
The dimension is represented as a single unsigned integer and each basic SI unit dimension exponent "occupies" 5 bits, i.e. the range for the exponent is -16..15. The system is based on the modular arithmetics so to calculate the result of the multiplication the two integers representing dimension simply need to be added, thus making operations on parameters with units extremely fast.
static uint Greet.UnitLib2.DimensionUtils.Denominator |
( |
uint |
dim | ) |
|
|
static |
Returns only the denominator units For example passing a uint representing J/kg will return kg
- Parameters
-
dim | The uint representing a dimension composed of a numerator and a denominator |
- Returns
- Denominator part only of the dimension parameter
static uint Greet.UnitLib2.DimensionUtils.Flip |
( |
uint |
dim | ) |
|
|
static |
Calculates 1/dim
- Parameters
-
- Returns
static uint Greet.UnitLib2.DimensionUtils.FromMLT |
( |
int |
kg, |
|
|
int |
m, |
|
|
int |
s, |
|
|
int |
c = 0 |
|
) |
| |
|
static |
Converts from natural units to a single integer that represents the dimension. int –> uint 0 –> 0 1 –> 1 ... 15 –> 15 -16 –> 16 -15 –> 17 -14 –> 18 -13 –> 19 -12 –> 20 -11 –> 21 -10 –> 22 -9 –> 23 -8 –> 24 -7 –> 25 -6 –> 26 -5 –> 27 -4 –> 28 -3 –> 29 -2 –> 30 -1 –> 31
- Parameters
-
kg | Mass |
m | Length |
s | Seconds |
c | Currency |
- Returns
static uint Greet.UnitLib2.DimensionUtils.Minus |
( |
uint |
a, |
|
|
uint |
b |
|
) |
| |
|
static |
Calculates the result of subtraction of dimensions. To be used to calculate the resulting dimension of dividing of two quantities
- Parameters
-
- Returns
static uint Greet.UnitLib2.DimensionUtils.Numerator |
( |
uint |
dim | ) |
|
|
static |
Returns only the numerator units For example passing a uint representing J/kg will return J
- Parameters
-
dim | The uint representing a dimension composed of a numerator and a denominator |
- Returns
- Numerator part only of the dimension parameter
static uint Greet.UnitLib2.DimensionUtils.Plus |
( |
uint |
a, |
|
|
uint |
b |
|
) |
| |
|
static |
Calculates the result of sum of dimensions. To be used to calculate the resulting dimension of multiplication of two quantities
- Parameters
-
- Returns
static uint Greet.UnitLib2.DimensionUtils.Times |
( |
uint |
a, |
|
|
int |
factor |
|
) |
| |
|
static |
Calculates the result of multiplying dimensions by an integer, to be used to calculate the dimension of the power operation
- Parameters
-
- Returns
static string Greet.UnitLib2.DimensionUtils.ToMLTh |
( |
uint |
dim | ) |
|
|
static |
Human readable dimensions string
- Parameters
-
- Returns
- Example: [mass]^1[length]^-1}]
static string Greet.UnitLib2.DimensionUtils.ToMLTUnith |
( |
uint |
dim | ) |
|
|
static |
Human readable SI unit expression
- Parameters
-
- Returns
- Example: kg/mi
The documentation for this class was generated from the following file:
- C:/Users/ddieffenthaler/Desktop/SVN/source/greet-dev/main/Lib/UnitLib2/DimensionUtils.cs