Skip to content

fury_uom_reference32 ​

FURY class definition of unit reference with float32 kind. FURY class implementation of unit reference with generic kind.

Source: src/lib/fury_uom_reference32.F90

Dependencies

Contents ​

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_symbolA is the main symbol of the unit reference; it is stored as the first reference alias and must respect:
    • uom_symbolA%offset_ = 0
    • uom_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

NameTypeAttributesDescription
aliasestype(uom_symbol)allocatableUom symbol aliases, e.g. "m = meter = metre" for metres.
aliases_numberinteger(kind=I_P)Number of defined symbol aliases.
dimensionstype(uom_symbol)Dimensions of the symbol, e.g. "length" for meter.

Type-Bound Procedures

NameAttributesDescription
dimensionalitypass(self)Return a string representation of the symbol dimensions.
get_aliasespass(self)Return the aliases list.
get_dimensionspass(self)Return the dimensions.
get_main_symbolpass(self)Return the main symbol, i.e. aliases(1).
is_definedpass(self)Check if the reference is defined.
parsepass(self)Parse reference from string.
prefixedpass(self)Return a prefixed reference.
setpass(self)Set reference.
set_alias_conversionpass(self)Set alias conversion formula.
stringifypass(self)Return a string representation of the reference.
topass(self)Convert magnitude with respect another alias.
unsetpass(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_compatiblepass(self)Check if the reference is compatible with another one.
is_equalpass(self)Check if the reference is equal with another one.
assign_uom_referencepass(lhs)uom_reference = uom_reference assignment.
divpass(lhs)uom_reference / uom_reference operator.
mulpass(lhs)uom_reference * uom_reference operator.
pow_R16Ppass(lhs)uom_reference ** real(R16P) operator.
pow_R8Ppass(lhs)uom_reference ** real(R8P) operator.
pow_R4Ppass(lhs)uom_reference ** real(R4P) operator.
pow_I8Ppass(lhs)uom_reference ** integer(I8P) operator.
pow_I4Ppass(lhs)uom_reference ** integer(I4P) operator.
pow_I2Ppass(lhs)uom_reference ** integer(I2P) operator.
pow_I1Ppass(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

fortran
subroutine get_aliases(self, aliases)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_reference)inThe uom reference.
aliasestype(uom_symbol)outallocatableAliases.

Call graph

get_dimensions ​

Return the dimensions.

Attributes: pure

fortran
subroutine get_dimensions(self, dimensions)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_reference)inThe uom reference.
dimensionstype(uom_symbol)outDimensions.

Call graph

parse ​

Parse uom_reference definition from string.

fortran
subroutine parse(self, source)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_reference)inoutThe uom reference.
sourcecharacter(len=*)inSource input string definition of symbol.

Call graph

set ​

Set reference.

Attributes: pure

fortran
subroutine set(self, aliases, dimensions)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_reference)inoutThe uom reference.
aliasestype(uom_symbol)inoptionalReference aliases.
dimensionstype(uom_symbol)inoptionalDimensions of the reference, e.g. "frequency" for Hz.

Call graph

set_alias_conversion ​

Set alias conversion formula.

Attributes: pure

fortran
subroutine set_alias_conversion(self, alias_index, convert)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_reference)inoutThe uom reference.
alias_indexinteger(kind=I_P)inIndex of the alias to which set the conversion formula.
convertclass(uom_converter)inGeneric conversion alias formula user-supplied.

Call graph

to ​

Convert magnitude with respect another alias.

Attributes: elemental

fortran
subroutine to(self, other, magnitude, converted, is_found)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_reference)inThe uom reference.
othertype(uom_reference)inOther unit reference used for conversion.
magnitudereal(kind=RKP)inMagnitude to be converted.
convertedreal(kind=RKP)outConverted magnitude.
is_foundlogicaloutFlag to check if a conversion alias has been found.

Call graph

unset ​

Unset reference.

Attributes: elemental

fortran
subroutine unset(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_reference)inoutThe uom reference.

Call graph

assign_uom_reference ​

uom_reference = uom_reference assignment.

Attributes: pure

fortran
subroutine assign_uom_reference(lhs, rhs)

Arguments

NameTypeIntentAttributesDescription
lhsclass(uom_reference)inoutLeft hand side.
rhstype(uom_reference)inRight hand side.

Call graph

Functions ​

creator_from_string ​

Create an instance of uom_reference.

Returns: type(uom_reference)

fortran
function creator_from_string(source) result(reference)

Arguments

NameTypeIntentAttributesDescription
sourcecharacter(len=*)inSource input string definition of the symbol.

Call graph

dimensionality ​

Return a string representation of uom_reference dimensions.

Attributes: pure

Returns: character(len=:)

fortran
function dimensionality(self) result(raw)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_reference)inThe uom reference.

Call graph

get_main_symbol ​

Return the main symbol, i.e. aliases(1).

Attributes: pure

Returns: type(uom_symbol)

fortran
function get_main_symbol(self) result(alias)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_reference)inThe uom reference.

Call graph

is_defined ​

Check if uom_reference is defined.

Attributes: elemental

Returns: logical

fortran
function is_defined(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_reference)inThe uom reference.

Call graph

prefixed ​

Return a prefixed reference.

Attributes: elemental

Returns: type(uom_reference)

fortran
function prefixed(self, prefixes)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_reference)inThe uom reference.
prefixestype(uom_reference)inOther reference used for prefixing.

Call graph

stringify ​

Return a string representation of uom_reference.

Attributes: pure

Returns: character(len=:)

fortran
function stringify(self, with_dimensions, with_aliases, protect_aliases, compact_reals) result(raw)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_reference)inThe uom reference.
with_dimensionslogicalinoptionalFlag to activate dimensions printing.
with_aliaseslogicalinoptionalFlag to activate aliases printing.
protect_aliaseslogicalinoptionalFlag to activate aliases printing in protected mode.
compact_realslogicalinoptionalFlag to activate real numbers compacting.

Call graph

is_compatible ​

Check if uom_reference is compatible with another one.

Attributes: elemental

Returns: logical

fortran
function is_compatible(self, other)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_reference)inThe uom reference.
othertype(uom_reference)inThe other reference.

Call graph

is_equal ​

Check if uom_reference is equal with another one.

Attributes: elemental

Returns: logical

fortran
function is_equal(self, other)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_reference)inThe uom reference.
othertype(uom_reference)inThe other reference.

Call graph

div ​

uom_reference / uom_reference operator.

Attributes: pure

Returns: type(uom_reference)

fortran
function div(lhs, rhs) result(opr)

Arguments

NameTypeIntentAttributesDescription
lhsclass(uom_reference)inLeft hand side.
rhstype(uom_reference)inRight hand side.

mul ​

uom_reference * uom_reference operator.

Attributes: pure

Returns: type(uom_reference)

fortran
function mul(lhs, rhs) result(opr)

Arguments

NameTypeIntentAttributesDescription
lhsclass(uom_reference)inLeft hand side.
rhstype(uom_reference)inRight hand side.

pow_R16P ​

uom_reference ** real(R16P) operator.

Attributes: pure

Returns: type(uom_reference)

fortran
function pow_R16P(lhs, rhs) result(opr)

Arguments

NameTypeIntentAttributesDescription
lhsclass(uom_reference)inLeft hand side.
rhsreal(kind=R16P)inRight hand side.

Call graph

pow_R8P ​

uom_reference ** real(R8P) operator.

Attributes: pure

Returns: type(uom_reference)

fortran
function pow_R8P(lhs, rhs) result(opr)

Arguments

NameTypeIntentAttributesDescription
lhsclass(uom_reference)inLeft hand side.
rhsreal(kind=R8P)inRight hand side.

Call graph

pow_R4P ​

uom_reference ** real(R4P) operator.

Attributes: pure

Returns: type(uom_reference)

fortran
function pow_R4P(lhs, rhs) result(opr)

Arguments

NameTypeIntentAttributesDescription
lhsclass(uom_reference)inLeft hand side.
rhsreal(kind=R4P)inRight hand side.

Call graph

pow_I8P ​

uom_reference ** integer(I8P) operator.

Attributes: pure

Returns: type(uom_reference)

fortran
function pow_I8P(lhs, rhs) result(opr)

Arguments

NameTypeIntentAttributesDescription
lhsclass(uom_reference)inLeft hand side.
rhsinteger(kind=I8P)inRight hand side.

Call graph

pow_I4P ​

uom_reference ** integer(I4P) operator.

Attributes: pure

Returns: type(uom_reference)

fortran
function pow_I4P(lhs, rhs) result(opr)

Arguments

NameTypeIntentAttributesDescription
lhsclass(uom_reference)inLeft hand side.
rhsinteger(kind=I4P)inRight hand side.

Call graph

pow_I2P ​

uom_reference ** integer(I2P) operator.

Attributes: pure

Returns: type(uom_reference)

fortran
function pow_I2P(lhs, rhs) result(opr)

Arguments

NameTypeIntentAttributesDescription
lhsclass(uom_reference)inLeft hand side.
rhsinteger(kind=I2P)inRight hand side.

Call graph

pow_I1P ​

uom_reference ** integer(I1P) operator.

Attributes: pure

Returns: type(uom_reference)

fortran
function pow_I1P(lhs, rhs) result(opr)

Arguments

NameTypeIntentAttributesDescription
lhsclass(uom_reference)inLeft hand side.
rhsinteger(kind=I1P)inRight hand side.

Call graph

Released under GPL v3, BSD 2-Clause, BSD 3-Clause or MIT, at your choice.