Unit of measure (UOM) class.
The string format definition of a valid FURY unit is as following:
uom_referenceA.uom_referenceB.... (uom_referenceALIAS[dimensions_alias]) {name}
where
uom_referenceA, uom_referenceB, ... are the defined uom references that must follow uom_reference syntax.(uom_referenceALIAS[dimensions_alias]) defines a unit alias that is optional and must come always
after unit reference definition;{name} defines the unit name that is optional and must be always the last term.For example, valid definition are:
kg [mass].m-1 = metre-1 = meter-1 [length-1].s-2 = seconds-2 = sec-2 [time-2] (Pa[pressure]) {pascal}km = 1000 * m [length].h-1 = 3600 s-1 [time-1] (km_h[speed]) {km/h}The aliases definition for uom_reference term can be protected by means of < and > that are optional, but highly
recommended, e.g.:
km< = 1000.0 * m> [length].h-1< = 3600.0 s-1> [time-1] (km_h[speed]) {km/h}This protection allows disambiguation of . symbols that are used for uom_reference separation and for real
offset/factor of aliases definition. Other valid definitions are:
kg.m-1.s-2 a unit without specified dimensions, alias and name;kg.m-1.s-2(Pa) a unit without specified dimensions and name, but with an alias without alias dimension;kg.m-1.s-2(Pa[pressure]) a unit without specified dimensions and name, but with an alias with alias dimension;kg.m-1.s-2{pascal} a unit without specified dimensions and alias, but with a name;
รจ kg.m-1.s-2(Pa){pascal} a unit without specified dimensions, but with an alias without alias dimension and a name;It is better to avoid to incomplete list of dimensions for references: define all dimensions for all references or avoid to define dimensions at all.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=:), | public, | allocatable | :: | name | Unit name. |
||
| type(uom_reference), | private, | allocatable | :: | alias | Alias of the unit, e.g Pa (kg.m-1.s-2) for Pascal. |
||
| type(uom_reference), | private, | allocatable | :: | references(:) | Reference units of the unit. |
||
| integer(kind=I_P), | private | :: | references_number | = | 0_I_P | References number. |
Ovearloading uom name with a set of creator functions.
Create an instance of uom from an input source string.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | source | Source input string definition of the unit. |
||
| type(uom_reference), | intent(in), | optional | :: | alias | Alias of the unit, e.g Pa (kg.m-1.s-2) for Pascal [pressure]. |
|
| character(len=*), | intent(in), | optional | :: | name | Unit name. |
The unit.
Return the alias.
Return the alias.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(in) | :: | self | The uom. |
||
| type(uom_reference), | intent(out) | :: | alias | Uom main alias. |
Return the main reference.
Return the main reference, i.e. self%alias if self%alias is defined or self%references(1) if self has only 1
uom_reference.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(in) | :: | self | The uom. |
Main uom reference.
Return the main symbol.
Return the main symbol, i.e. self%alias%aliases(1)%symbol_ if self%alias is defined or
self%references(1)%aliases(1)%symbol_ if self has only 1 uom_reference.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(in) | :: | self | The uom. |
Main alias symbol.
Return the references.
Return the references.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(in) | :: | self | The uom. |
||
| type(uom_reference), | intent(out), | allocatable | :: | references(:) | Uom references. |
Check if the unit has an alias.
Check if the unit has a name.
Check if the unit has a queried reference unit.
Check if the unit has a queried reference unit.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(in) | :: | self | The unit. |
||
| type(uom_reference), | intent(in) | :: | reference | Reference unit to check the presence of. |
reference unit presence status.
Check if the unit is defined.
Check if the unit has been defined, namely it has defined references.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(in) | :: | self | The unit. |
Definition status.
Return prefixed unit.
Return prefixed unit.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(in) | :: | self | The unit. |
||
| type(uom_reference), | intent(in) | :: | prefixes | Prefixes data. |
Prefixed unit.
Set the unit.
Set the unit.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(inout) | :: | self | The unit. |
||
| type(uom_reference), | intent(in), | optional | :: | references(1:) | Unit references of the unit. |
|
| type(uom_reference), | intent(in), | optional | :: | alias | Alias of the unit, e.g Pa (kg.m-1.s-2) for Pascal [pressure]. |
|
| character(len=*), | intent(in), | optional | :: | name | Unit name. |
Set alias conversion formula.
Set alias conversion formula.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(inout) | :: | self | The uom reference. |
||
| integer(kind=I_P), | intent(in) | :: | reference_index | Index of the reference to which set the conversion formula. |
||
| integer(kind=I_P), | intent(in) | :: | alias_index | Index of the alias to which set the conversion formula. |
||
| class(uom_converter), | intent(in) | :: | convert | Generic conversion alias formula user-supplied. |
Return a string representation of the unit.
Return a string representation of the unit.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(in) | :: | self | The unit. |
||
| logical, | intent(in), | optional | :: | with_dimensions | Flag to activate dimensions printing. |
|
| logical, | intent(in), | optional | :: | with_aliases | Flag to activate aliases printing. |
|
| logical, | intent(in), | optional | :: | protect_aliases | Flag to activate aliases printing in protected mode. |
|
| logical, | intent(in), | optional | :: | with_name | Flag to activate name printing. |
|
| logical, | intent(in), | optional | :: | compact_reals | Flag to activate real numbers compacting. |
Raw characters data.
Convert magnitude with respect another unit.
Convert magnitude with respect another unit.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(in) | :: | self | The uom. |
||
| type(uom), | intent(in) | :: | other | Other unit used for conversion. |
||
| real(kind=RKP), | intent(in) | :: | magnitude | Magnitude to be converted. |
Converted magnitude.
unset the unit.
Overloading = operator.
uom = uom assignment.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(inout) | :: | lhs | Left hand side. |
||
| class(uom), | intent(in) | :: | rhs | Right hand side. |
Overloading + operator.
Overloading / operator.
Overloading * operator.
Overloading - operator.
Overloading ** operator.
uom ** real(R8P) operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(in) | :: | lhs | Left hand side. |
||
| real(kind=R8P), | intent(in) | :: | rhs | Right hand side. |
Operator result.
uom ** real(R4P) operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(in) | :: | lhs | Left hand side. |
||
| real(kind=R4P), | intent(in) | :: | rhs | Right hand side. |
Operator result.
uom ** integer(I8P) operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(in) | :: | lhs | Left hand side. |
||
| integer(kind=I8P), | intent(in) | :: | rhs | Right hand side. |
Operator result.
uom ** integer(I4P) operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(in) | :: | lhs | Left hand side. |
||
| integer(kind=I4P), | intent(in) | :: | rhs | Right hand side. |
Operator result.
uom ** integer(I2P) operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(in) | :: | lhs | Left hand side. |
||
| integer(kind=I2P), | intent(in) | :: | rhs | Right hand side. |
Operator result.
uom ** integer(I1P) operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(in) | :: | lhs | Left hand side. |
||
| integer(kind=I1P), | intent(in) | :: | rhs | Right hand side. |
Operator result.
Overloading == operator.
Add a reference unit to unit.
Add reference unit to unit.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(inout) | :: | self | The unit. |
||
| type(uom_reference), | intent(in) | :: | reference | Unit reference to be added. |
Check if unit is equal with another one.
Parse unit definition from an input string.
Parse unit alias from an input string.
Parse unit alias form an input string and return also the source string without the alias data.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(inout) | :: | self | The unit. |
||
| type(string), | intent(inout) | :: | source | Input source string. |
Parse unit name from an input string.
Parse unit name form an input string and return also the source string without the name data.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(inout) | :: | self | The unit. |
||
| type(string), | intent(inout) | :: | source | Input source string. |
Parse reference units from an input string.
Parse references units form an input string.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(inout) | :: | self | The unit. |
||
| type(string), | intent(in) | :: | source | Input source string. |
Update reference units number counter.
Update references number counter.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(inout) | :: | self | The unit. |
uom = uom assignment.
uom = uom assignment.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(uom), | intent(inout) | :: | lhs | Left hand side. |
||
| class(uom), | intent(in) | :: | rhs | Right hand side. |
uom + uom operator.
uom / uom operator.
uom * uom operator.
uom - uom operator.
uom ** real(R16P) operator.
uom ** real(R8P) operator.
uom ** real(R4P) operator.
uom ** integer(I8P) operator.
uom ** integer(I4P) operator.
uom ** integer(I2P) operator.
uom ** integer(I1P) operator.