Skip to content

fury_uom_symbol32 ​

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

Source: src/lib/fury_uom_symbol32.F90

Dependencies

Contents ​

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; +@user is 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_offset is omitted because equal to 0 and real_factor and integer_exponent are 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 mW where the placeholder @user will be set (not by the string parser) to 10 * 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

NameTypeAttributesDescription
convert_type(uom_converter_box)allocatableGeneric 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

NameAttributesDescription
convertpass(self)Convert a magnitude with respect symbol definition.
get_convertpass(self)Return the symbol generic conversion alias.
get_exponentpass(self)Return the symbol exponent.
get_factorpass(self)Return the symbol factor.
get_offsetpass(self)Return the symbol offset.
get_symbolpass(self)Return the literal symbol.
is_definedpass(self)Check if the symbol is defined.
parsepass(self)Parse symbol from string.
prefixedpass(self)Return a prefixed symbol.
setpass(self)Set symbol.
stringifypass(self)Return a string representaion of the symbol.
unsetpass(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_compatiblepass(self)Check if the symbol is compatible with another one.
is_convertiblepass(self)Check if the symbol is convertible with another one.
is_equalpass(self)Check if the symbol is equal with another one.
assign_uom_symbolpass(lhs)uom_symbol = uom_symbol assignment.
divpass(lhs)uom_symbol / uom_symbol operator.
mulpass(lhs)uom_symbol * uom_symbol operator.
pow_R16Ppass(lhs)uom_symbol ** real(R16P) operator.
pow_R8Ppass(lhs)uom_symbol ** real(R8P) operator.
pow_R4Ppass(lhs)uom_symbol ** real(R4P) operator.
pow_I8Ppass(lhs)uom_symbol ** integer(I8P) operator.
pow_I4Ppass(lhs)uom_symbol ** integer(I4P) operator.
pow_I2Ppass(lhs)uom_symbol ** integer(I2P) operator.
pow_I1Ppass(lhs)uom_symbol ** integer(I1P) operator.

Subroutines ​

get_convert ​

Return the symbol generic conversion alias.

fortran
subroutine get_convert(self, convert_)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_symbol)inThe uom symbol.
convert_class(uom_converter)outallocatableThe symbol generic conversion alias.

Call graph

parse ​

Parse symbol definition from string.

fortran
subroutine parse(self, source)

Arguments

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

Call graph

set ​

Set symbol.

Attributes: elemental

fortran
subroutine set(self, symbol_, exponent_, factor_, offset_, convert_)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_symbol)inoutThe uom symbol.
symbol_character(len=*)inoptionalliteral symbol of the unit, e.g. "m" for metres.
exponent_integer(kind=IKP)inoptionalExponent of the symbol, e.g. "-1" for Hertz, namely "s-1".
factor_real(kind=RKP)inoptionalSymbol multiplicative scale factor (used only for converters).
offset_real(kind=RKP)inoptionalSymbol additive offset (used only for converters).
convert_class(uom_converter)inoptionalGeneric conversion alias formula user-supplied.

Call graph

unset ​

Unset symbol.

Attributes: elemental

fortran
subroutine unset(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_symbol)inoutThe uom symbol.

Call graph

assign_uom_symbol ​

uom_symbol = uom_symbol assignment.

Attributes: pure

fortran
subroutine assign_uom_symbol(lhs, rhs)

Arguments

NameTypeIntentAttributesDescription
lhsclass(uom_symbol)inoutLeft hand side.
rhstype(uom_symbol)inRight 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)

fortran
function convert(self, magnitude, inverse) result(converted)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_symbol)inThe uom symbol.
magnitudereal(kind=RKP)inMagnitude to be converted.
inverselogicalinoptionalActivate inverse conversion.

Call graph

get_exponent ​

Return the symbol exponent.

Attributes: elemental

Returns: integer(kind=IKP)

fortran
function get_exponent(self) result(exponent_)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_symbol)inThe uom symbol.

Call graph

get_factor ​

Return the symbol factor.

Attributes: elemental

Returns: real(kind=RKP)

fortran
function get_factor(self) result(factor_)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_symbol)inThe uom symbol.

Call graph

get_offset ​

Return the symbol offset.

Attributes: elemental

Returns: real(kind=RKP)

fortran
function get_offset(self) result(offset_)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_symbol)inThe uom symbol.

Call graph

get_symbol ​

Return the literal symbol.

Attributes: elemental

Returns: type(string)

fortran
function get_symbol(self) result(symbol_)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_symbol)inThe uom symbol.

Call graph

is_defined ​

Check if uom_symbol is defined.

Attributes: elemental

Returns: logical

fortran
function is_defined(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_symbol)inThe uom symbol.

Call graph

prefixed ​

Return a prefixed symbol.

Attributes: elemental

Returns: type(uom_symbol)

fortran
function prefixed(self, prefix)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_symbol)inThe uom symbol.
prefixtype(uom_symbol)inOther symbol used for prefixing.

Call graph

stringify ​

Return a string representation of uom_symbol.

Attributes: pure

Returns: character(len=:)

fortran
function stringify(self, compact_reals) result(raw)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_symbol)inThe uom symbol.
compact_realslogicalinoptionalFlag 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

fortran
function is_compatible(self, other)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_symbol)inThe uom symbol.
othertype(uom_symbol)inThe 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

fortran
function is_convertible(self, other)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_symbol)inThe uom symbol.
othertype(uom_symbol)inThe 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

fortran
function is_equal(self, other)

Arguments

NameTypeIntentAttributesDescription
selfclass(uom_symbol)inThe uom symbol.
othertype(uom_symbol)inThe other symbol.

Call graph

div ​

uom_symbol / uom_symbol operator.

Attributes: pure

Returns: type(uom_symbol)

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

Arguments

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

mul ​

uom_symbol * uom_symbol operator.

Attributes: pure

Returns: type(uom_symbol)

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

Arguments

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

pow_R16P ​

uom_symbol ** real(R16P) operator.

Attributes: pure

Returns: type(uom_symbol)

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

Arguments

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

Call graph

pow_R8P ​

uom_symbol ** real(R8P) operator.

Attributes: pure

Returns: type(uom_symbol)

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

Arguments

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

Call graph

pow_R4P ​

uom_symbol ** real(R4P) operator.

Attributes: pure

Returns: type(uom_symbol)

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

Arguments

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

Call graph

pow_I8P ​

uom_symbol ** integer(I8P) operator.

Attributes: pure

Returns: type(uom_symbol)

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

Arguments

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

Call graph

pow_I4P ​

uom_symbol ** integer(I4P) operator.

Attributes: pure

Returns: type(uom_symbol)

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

Arguments

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

Call graph

pow_I2P ​

uom_symbol ** integer(I2P) operator.

Attributes: pure

Returns: type(uom_symbol)

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

Arguments

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

Call graph

pow_I1P ​

uom_symbol ** integer(I1P) operator.

Attributes: pure

Returns: type(uom_symbol)

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

Arguments

NameTypeIntentAttributesDescription
lhsclass(uom_symbol)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.