fury_uom_symbol64
FURY class definition of unit symbol with float64 kind. FURY class implementation of unit symbol with generic kind.
Source: src/lib/fury_uom_symbol64.F90
Dependencies
Contents
- uom_symbol
- get_convert
- parse
- set
- unset
- assign_uom_symbol
- convert
- get_exponent
- get_factor
- get_offset
- get_symbol
- is_defined
- prefixed
- stringify
- is_compatible
- is_convertible
- is_equal
- div
- mul
- pow_R16P
- pow_R8P
- pow_R4P
- pow_I8P
- pow_I4P
- pow_I2P
- pow_I1P
Derived Types
uom_symbol
Unit of measure (UOM) symbol.
It is the base unit class composed by only 1 symbol.
Provide math operations on symbols necessary to build complex (derived) units.
The string format definition of a valid FURY unit symbol definition are as following:
- multiplicative-like definition:
real_offset + real_factor * litteral_symbol integer_exponent - generic user-supplied definition:
@user litteral_symbol integer_exponent
where
+real_offset + is an optional real literal constant that, if present, must be followed by a +; +real_factor + is an optional real literal constant that, if present, must be followed by a *; +litteral_symbol is the literal symbol; +integer_exponent is an optional integer literal constant that:
- could be omitted if it is equal to 1;
- do not have the
+sign if positive; - must have the
-sign if negative; +@useris a place order for the parser indicating that the alias-conversion definition is not a simple - multiplicative-like conversion, but it is a generic user-supplied one.
For example, valid definition are:
s: a second definition;real_offsetis omitted because equal to 0 andreal_factorandinteger_exponentare omitted because equal to 1;1.E6 * m2: a square kilometer definition;1000 * s-1: a kiloherhz definition;273.15 + K: a Celsius degree definition;dBm = @user mWwhere the placeholder@userwill be set (not by the string parser) to10 * log(mW).
The terms composing a definition can be separated by any white spaces number (even zero).
In the case the user supply a generic conversion alias formula this one overrides the multiplicative-like optionally parsed.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
convert_ | type(uom_converter_box) | allocatable | Generic conversion alias formula user-supplied. |
exponent_ | integer(kind=IKP) | Exponent of the symbol, e.g. "-1" for Hertz, namely "s-1". | |
factor_ | real(kind=RKP) | Symbol multiplicative scale factor (used only for converters). | |
offset_ | real(kind=RKP) | Symbol additive offset (used only for converters). | |
symbol_ | type(string) | literal symbol, e.g. "m" for metres. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
convert | pass(self) | Convert a magnitude with respect symbol definition. |
get_convert | pass(self) | Return the symbol generic conversion alias. |
get_exponent | pass(self) | Return the symbol exponent. |
get_factor | pass(self) | Return the symbol factor. |
get_offset | pass(self) | Return the symbol offset. |
get_symbol | pass(self) | Return the literal symbol. |
is_defined | pass(self) | Check if the symbol is defined. |
parse | pass(self) | Parse symbol from string. |
prefixed | pass(self) | Return a prefixed symbol. |
set | pass(self) | Set symbol. |
stringify | pass(self) | Return a string representaion of the symbol. |
unset | pass(self) | Unset symbol. |
assignment(=) | Overloading = assignment. Generic: assign_uom_symbol | |
operator(/) | Overloading / operator. Generic: div | |
operator(*) | Overloading * operator. Generic: mul | |
operator(**) | Overloading ** operator. Generic: pow_R8P, pow_R4P, pow_I8P, pow_I4P, pow_I2P, pow_I1P | |
operator(==) | Overloading == operator. Generic: is_equal | |
operator(.compatible.) | Definition of .compatible. operator. Generic: is_compatible | |
operator(.convertible.) | Definition of .convertible. operator. Generic: is_convertible | |
is_compatible | pass(self) | Check if the symbol is compatible with another one. |
is_convertible | pass(self) | Check if the symbol is convertible with another one. |
is_equal | pass(self) | Check if the symbol is equal with another one. |
assign_uom_symbol | pass(lhs) | uom_symbol = uom_symbol assignment. |
div | pass(lhs) | uom_symbol / uom_symbol operator. |
mul | pass(lhs) | uom_symbol * uom_symbol operator. |
pow_R16P | pass(lhs) | uom_symbol ** real(R16P) operator. |
pow_R8P | pass(lhs) | uom_symbol ** real(R8P) operator. |
pow_R4P | pass(lhs) | uom_symbol ** real(R4P) operator. |
pow_I8P | pass(lhs) | uom_symbol ** integer(I8P) operator. |
pow_I4P | pass(lhs) | uom_symbol ** integer(I4P) operator. |
pow_I2P | pass(lhs) | uom_symbol ** integer(I2P) operator. |
pow_I1P | pass(lhs) | uom_symbol ** integer(I1P) operator. |
Subroutines
get_convert
Return the symbol generic conversion alias.
subroutine get_convert(self, convert_)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_symbol) | in | The uom symbol. | |
convert_ | class(uom_converter) | out | allocatable | The symbol generic conversion alias. |
Call graph
parse
Parse symbol definition from string.
subroutine parse(self, source)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_symbol) | inout | The uom symbol. | |
source | character(len=*) | in | Source input string definition of symbol. |
Call graph
set
Set symbol.
Attributes: elemental
subroutine set(self, symbol_, exponent_, factor_, offset_, convert_)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_symbol) | inout | The uom symbol. | |
symbol_ | character(len=*) | in | optional | literal symbol of the unit, e.g. "m" for metres. |
exponent_ | integer(kind=IKP) | in | optional | Exponent of the symbol, e.g. "-1" for Hertz, namely "s-1". |
factor_ | real(kind=RKP) | in | optional | Symbol multiplicative scale factor (used only for converters). |
offset_ | real(kind=RKP) | in | optional | Symbol additive offset (used only for converters). |
convert_ | class(uom_converter) | in | optional | Generic conversion alias formula user-supplied. |
Call graph
unset
Unset symbol.
Attributes: elemental
subroutine unset(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_symbol) | inout | The uom symbol. |
Call graph
assign_uom_symbol
uom_symbol = uom_symbol assignment.
Attributes: pure
subroutine assign_uom_symbol(lhs, rhs)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_symbol) | inout | Left hand side. | |
rhs | type(uom_symbol) | in | Right hand side. |
Call graph
Functions
convert
Convert a magnitude with respect symbol definition.
Two conversions are possible: direct and inverse, namely
- direct conversion:
converted = offset+ factor * magnitude - inverse conversion:
converted = (magnitude - offset)/factor
Attributes: elemental
Returns: real(kind=RKP)
function convert(self, magnitude, inverse) result(converted)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_symbol) | in | The uom symbol. | |
magnitude | real(kind=RKP) | in | Magnitude to be converted. | |
inverse | logical | in | optional | Activate inverse conversion. |
Call graph
get_exponent
Return the symbol exponent.
Attributes: elemental
Returns: integer(kind=IKP)
function get_exponent(self) result(exponent_)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_symbol) | in | The uom symbol. |
Call graph
get_factor
Return the symbol factor.
Attributes: elemental
Returns: real(kind=RKP)
function get_factor(self) result(factor_)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_symbol) | in | The uom symbol. |
Call graph
get_offset
Return the symbol offset.
Attributes: elemental
Returns: real(kind=RKP)
function get_offset(self) result(offset_)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_symbol) | in | The uom symbol. |
Call graph
get_symbol
Return the literal symbol.
Attributes: elemental
Returns: type(string)
function get_symbol(self) result(symbol_)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_symbol) | in | The uom symbol. |
Call graph
is_defined
Check if uom_symbol is defined.
Attributes: elemental
Returns: logical
function is_defined(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_symbol) | in | The uom symbol. |
Call graph
prefixed
Return a prefixed symbol.
Attributes: elemental
Returns: type(uom_symbol)
function prefixed(self, prefix)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_symbol) | in | The uom symbol. | |
prefix | type(uom_symbol) | in | Other symbol used for prefixing. |
Call graph
stringify
Return a string representation of uom_symbol.
Attributes: pure
Returns: character(len=:)
function stringify(self, compact_reals) result(raw)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_symbol) | in | The uom symbol. | |
compact_reals | logical | in | optional | Flag to activate real numbers compacting. |
Call graph
is_compatible
Check if uom_symbol is compatible with another one.
Two symbols are defined compatible if they have the same literal symbol, unconcerned other attributes.
Attributes: elemental
Returns: logical
function is_compatible(self, other)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_symbol) | in | The uom symbol. | |
other | type(uom_symbol) | in | The other symbol. |
Call graph
is_convertible
Check if uom_symbol is convertible with another one.
Two symbols are defined convertible if they have the same literal symbol, unconcerned other attributes.
Attributes: elemental
Returns: logical
function is_convertible(self, other)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_symbol) | in | The uom symbol. | |
other | type(uom_symbol) | in | The other symbol. |
Call graph
is_equal
Check if uom_symbol is equal with another one.
Two symbols are defined equal if all their attributes are identical.
Attributes: elemental
Returns: logical
function is_equal(self, other)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_symbol) | in | The uom symbol. | |
other | type(uom_symbol) | in | The other symbol. |
Call graph
div
uom_symbol / uom_symbol operator.
Attributes: pure
Returns: type(uom_symbol)
function div(lhs, rhs) result(opr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_symbol) | in | Left hand side. | |
rhs | type(uom_symbol) | in | Right hand side. |
mul
uom_symbol * uom_symbol operator.
Attributes: pure
Returns: type(uom_symbol)
function mul(lhs, rhs) result(opr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_symbol) | in | Left hand side. | |
rhs | type(uom_symbol) | in | Right hand side. |
pow_R16P
uom_symbol ** real(R16P) operator.
Attributes: pure
Returns: type(uom_symbol)
function pow_R16P(lhs, rhs) result(opr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_symbol) | in | Left hand side. | |
rhs | real(kind=R16P) | in | Right hand side. |
Call graph
pow_R8P
uom_symbol ** real(R8P) operator.
Attributes: pure
Returns: type(uom_symbol)
function pow_R8P(lhs, rhs) result(opr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_symbol) | in | Left hand side. | |
rhs | real(kind=R8P) | in | Right hand side. |
Call graph
pow_R4P
uom_symbol ** real(R4P) operator.
Attributes: pure
Returns: type(uom_symbol)
function pow_R4P(lhs, rhs) result(opr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_symbol) | in | Left hand side. | |
rhs | real(kind=R4P) | in | Right hand side. |
Call graph
pow_I8P
uom_symbol ** integer(I8P) operator.
Attributes: pure
Returns: type(uom_symbol)
function pow_I8P(lhs, rhs) result(opr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_symbol) | in | Left hand side. | |
rhs | integer(kind=I8P) | in | Right hand side. |
Call graph
pow_I4P
uom_symbol ** integer(I4P) operator.
Attributes: pure
Returns: type(uom_symbol)
function pow_I4P(lhs, rhs) result(opr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_symbol) | in | Left hand side. | |
rhs | integer(kind=I4P) | in | Right hand side. |
Call graph
pow_I2P
uom_symbol ** integer(I2P) operator.
Attributes: pure
Returns: type(uom_symbol)
function pow_I2P(lhs, rhs) result(opr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_symbol) | in | Left hand side. | |
rhs | integer(kind=I2P) | in | Right hand side. |
Call graph
pow_I1P
uom_symbol ** integer(I1P) operator.
Attributes: pure
Returns: type(uom_symbol)
function pow_I1P(lhs, rhs) result(opr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_symbol) | in | Left hand side. | |
rhs | integer(kind=I1P) | in | Right hand side. |
Call graph