Greet 2014
Documentation for the GREET 2014 API
 All Classes Namespaces Functions Variables Enumerations Properties Events
Greet.UnitLib2.DimensionUtils Class Reference

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 Public Member Functions

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 Public Attributes

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)
 

Detailed Description

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.

Member Function Documentation

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
dimThe 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
dim
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
kgMass
mLength
sSeconds
cCurrency
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
a
b
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
dimThe 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
a
b
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
a
factor
Returns
static string Greet.UnitLib2.DimensionUtils.ToMLTh ( uint  dim)
static

Human readable dimensions string

Parameters
dim
Returns
Example: [mass]^1[length]^-1}]
static string Greet.UnitLib2.DimensionUtils.ToMLTUnith ( uint  dim)
static

Human readable SI unit expression

Parameters
dim
Returns
Example: kg/mi

The documentation for this class was generated from the following file: