fury_uom_reference64
FURY class definition of unit reference with float64 kind. FURY class implementation of unit reference with generic kind.
Source: src/lib/fury_uom_reference64.F90
Dependencies
Contents
- uom_reference
- uom_reference
- get_aliases
- get_dimensions
- parse
- set
- set_alias_conversion
- to
- unset
- assign_uom_reference
- creator_from_string
- dimensionality
- get_main_symbol
- is_defined
- prefixed
- stringify
- is_compatible
- is_equal
- div
- mul
- pow_R16P
- pow_R8P
- pow_R4P
- pow_I8P
- pow_I4P
- pow_I2P
- pow_I1P
Derived Types
uom_reference
Unit of measure reference class.
It is the reference unit class composed by only 1 symbol, but with many possible aliases that can be used for conversions.
Provide math operations on symbols necessary to build complex (derived) units.
The string format definition of a valid FURY unit reference definition is as following:
uom_symbolA = uom_symbolB = uom_symbolC = ... [dimensionsA]
where
uom_symbolAis the main symbol of the unit reference; it is stored as the first reference alias and must respect:uom_symbolA%offset_ = 0uom_symbolA%factor_ = 1
uom_symbolB, uom_symbolC, ...are the defined aliases and they are optional; they could be totally general with offset and factor used for conversion formulas, until they respect the uom_symbol syntax;[dimensions]is the last optional term that defines the symbol dimensions (if dimensions exponent is passed it must be equal to the one of the main symbol.
For example, valid definition are:
s-1 = Hz = hertz [time-1]kHz< = 1000.0 * Hz = kilohertz> [frequency]degC< = celsius = 273.15 + K> [temperature]
These terms can be separated by any white spaces number (even zero), but the dimensions must be enclosed into [] brackets at the end of the string.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
aliases | type(uom_symbol) | allocatable | Uom symbol aliases, e.g. "m = meter = metre" for metres. |
aliases_number | integer(kind=I_P) | Number of defined symbol aliases. | |
dimensions | type(uom_symbol) | Dimensions of the symbol, e.g. "length" for meter. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
dimensionality | pass(self) | Return a string representation of the symbol dimensions. |
get_aliases | pass(self) | Return the aliases list. |
get_dimensions | pass(self) | Return the dimensions. |
get_main_symbol | pass(self) | Return the main symbol, i.e. aliases(1). |
is_defined | pass(self) | Check if the reference is defined. |
parse | pass(self) | Parse reference from string. |
prefixed | pass(self) | Return a prefixed reference. |
set | pass(self) | Set reference. |
set_alias_conversion | pass(self) | Set alias conversion formula. |
stringify | pass(self) | Return a string representation of the reference. |
to | pass(self) | Convert magnitude with respect another alias. |
unset | pass(self) | Unset reference. |
assignment(=) | Overloading = assignment. Generic: assign_uom_reference | |
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 | |
is_compatible | pass(self) | Check if the reference is compatible with another one. |
is_equal | pass(self) | Check if the reference is equal with another one. |
assign_uom_reference | pass(lhs) | uom_reference = uom_reference assignment. |
div | pass(lhs) | uom_reference / uom_reference operator. |
mul | pass(lhs) | uom_reference * uom_reference operator. |
pow_R16P | pass(lhs) | uom_reference ** real(R16P) operator. |
pow_R8P | pass(lhs) | uom_reference ** real(R8P) operator. |
pow_R4P | pass(lhs) | uom_reference ** real(R4P) operator. |
pow_I8P | pass(lhs) | uom_reference ** integer(I8P) operator. |
pow_I4P | pass(lhs) | uom_reference ** integer(I4P) operator. |
pow_I2P | pass(lhs) | uom_reference ** integer(I2P) operator. |
pow_I1P | pass(lhs) | uom_reference ** integer(I1P) operator. |
Interfaces
uom_reference
Overloading uom_reference name with a creator function.
Module procedures: creator_from_string
Subroutines
get_aliases
Return the aliases list.
Attributes: pure
subroutine get_aliases(self, aliases)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_reference) | in | The uom reference. | |
aliases | type(uom_symbol) | out | allocatable | Aliases. |
Call graph
get_dimensions
Return the dimensions.
Attributes: pure
subroutine get_dimensions(self, dimensions)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_reference) | in | The uom reference. | |
dimensions | type(uom_symbol) | out | Dimensions. |
Call graph
parse
Parse uom_reference definition from string.
subroutine parse(self, source)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_reference) | inout | The uom reference. | |
source | character(len=*) | in | Source input string definition of symbol. |
Call graph
set
Set reference.
Attributes: pure
subroutine set(self, aliases, dimensions)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_reference) | inout | The uom reference. | |
aliases | type(uom_symbol) | in | optional | Reference aliases. |
dimensions | type(uom_symbol) | in | optional | Dimensions of the reference, e.g. "frequency" for Hz. |
Call graph
set_alias_conversion
Set alias conversion formula.
Attributes: pure
subroutine set_alias_conversion(self, alias_index, convert)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_reference) | inout | The uom reference. | |
alias_index | integer(kind=I_P) | in | Index of the alias to which set the conversion formula. | |
convert | class(uom_converter) | in | Generic conversion alias formula user-supplied. |
Call graph
to
Convert magnitude with respect another alias.
Attributes: elemental
subroutine to(self, other, magnitude, converted, is_found)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_reference) | in | The uom reference. | |
other | type(uom_reference) | in | Other unit reference used for conversion. | |
magnitude | real(kind=RKP) | in | Magnitude to be converted. | |
converted | real(kind=RKP) | out | Converted magnitude. | |
is_found | logical | out | Flag to check if a conversion alias has been found. |
Call graph
unset
Unset reference.
Attributes: elemental
subroutine unset(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_reference) | inout | The uom reference. |
Call graph
assign_uom_reference
uom_reference = uom_reference assignment.
Attributes: pure
subroutine assign_uom_reference(lhs, rhs)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_reference) | inout | Left hand side. | |
rhs | type(uom_reference) | in | Right hand side. |
Call graph
Functions
creator_from_string
Create an instance of uom_reference.
Returns: type(uom_reference)
function creator_from_string(source) result(reference)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
source | character(len=*) | in | Source input string definition of the symbol. |
Call graph
dimensionality
Return a string representation of uom_reference dimensions.
Attributes: pure
Returns: character(len=:)
function dimensionality(self) result(raw)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_reference) | in | The uom reference. |
Call graph
get_main_symbol
Return the main symbol, i.e. aliases(1).
Attributes: pure
Returns: type(uom_symbol)
function get_main_symbol(self) result(alias)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_reference) | in | The uom reference. |
Call graph
is_defined
Check if uom_reference is defined.
Attributes: elemental
Returns: logical
function is_defined(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_reference) | in | The uom reference. |
Call graph
prefixed
Return a prefixed reference.
Attributes: elemental
Returns: type(uom_reference)
function prefixed(self, prefixes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_reference) | in | The uom reference. | |
prefixes | type(uom_reference) | in | Other reference used for prefixing. |
Call graph
stringify
Return a string representation of uom_reference.
Attributes: pure
Returns: character(len=:)
function stringify(self, with_dimensions, with_aliases, protect_aliases, compact_reals) result(raw)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_reference) | in | The uom reference. | |
with_dimensions | logical | in | optional | Flag to activate dimensions printing. |
with_aliases | logical | in | optional | Flag to activate aliases printing. |
protect_aliases | logical | in | optional | Flag to activate aliases printing in protected mode. |
compact_reals | logical | in | optional | Flag to activate real numbers compacting. |
Call graph
is_compatible
Check if uom_reference is compatible with another one.
Attributes: elemental
Returns: logical
function is_compatible(self, other)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_reference) | in | The uom reference. | |
other | type(uom_reference) | in | The other reference. |
Call graph
is_equal
Check if uom_reference is equal with another one.
Attributes: elemental
Returns: logical
function is_equal(self, other)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(uom_reference) | in | The uom reference. | |
other | type(uom_reference) | in | The other reference. |
Call graph
div
uom_reference / uom_reference operator.
Attributes: pure
Returns: type(uom_reference)
function div(lhs, rhs) result(opr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_reference) | in | Left hand side. | |
rhs | type(uom_reference) | in | Right hand side. |
mul
uom_reference * uom_reference operator.
Attributes: pure
Returns: type(uom_reference)
function mul(lhs, rhs) result(opr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_reference) | in | Left hand side. | |
rhs | type(uom_reference) | in | Right hand side. |
pow_R16P
uom_reference ** real(R16P) operator.
Attributes: pure
Returns: type(uom_reference)
function pow_R16P(lhs, rhs) result(opr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_reference) | in | Left hand side. | |
rhs | real(kind=R16P) | in | Right hand side. |
Call graph
pow_R8P
uom_reference ** real(R8P) operator.
Attributes: pure
Returns: type(uom_reference)
function pow_R8P(lhs, rhs) result(opr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_reference) | in | Left hand side. | |
rhs | real(kind=R8P) | in | Right hand side. |
Call graph
pow_R4P
uom_reference ** real(R4P) operator.
Attributes: pure
Returns: type(uom_reference)
function pow_R4P(lhs, rhs) result(opr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_reference) | in | Left hand side. | |
rhs | real(kind=R4P) | in | Right hand side. |
Call graph
pow_I8P
uom_reference ** integer(I8P) operator.
Attributes: pure
Returns: type(uom_reference)
function pow_I8P(lhs, rhs) result(opr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_reference) | in | Left hand side. | |
rhs | integer(kind=I8P) | in | Right hand side. |
Call graph
pow_I4P
uom_reference ** integer(I4P) operator.
Attributes: pure
Returns: type(uom_reference)
function pow_I4P(lhs, rhs) result(opr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_reference) | in | Left hand side. | |
rhs | integer(kind=I4P) | in | Right hand side. |
Call graph
pow_I2P
uom_reference ** integer(I2P) operator.
Attributes: pure
Returns: type(uom_reference)
function pow_I2P(lhs, rhs) result(opr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_reference) | in | Left hand side. | |
rhs | integer(kind=I2P) | in | Right hand side. |
Call graph
pow_I1P
uom_reference ** integer(I1P) operator.
Attributes: pure
Returns: type(uom_reference)
function pow_I1P(lhs, rhs) result(opr)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(uom_reference) | in | Left hand side. | |
rhs | integer(kind=I1P) | in | Right hand side. |
Call graph