uom_symbol Derived Type

type, public :: uom_symbol

type~~uom_symbol~~InheritsGraph type~uom_symbol uom_symbol type~uom_converter uom_converter type~uom_converter->type~uom_symbol convert_ type~string string type~string->type~uom_symbol symbol_
Help


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.

Inherited By

type~~uom_symbol~~InheritedByGraph type~uom_symbol uom_symbol type~uom_reference uom_reference type~uom_symbol->type~uom_reference aliases, dimensions type~system_si system_si type~uom_reference->type~system_si prefixes type~uom uom type~uom_reference->type~uom alias, references type~system_abstract system_abstract type~uom_reference->type~system_abstract prefixes type~uom->type~system_si units type~uom->type~system_abstract units type~qreal qreal type~uom->type~qreal unit type~system_abstract->type~system_si type~qreal->type~system_si constants type~qreal->type~system_abstract constants
Help

Components

TypeVisibility AttributesNameInitial
class(uom_converter), private, allocatable:: convert_

Generic conversion alias formula user-supplied.

integer(kind=IKP), private :: exponent_ =1_IKP

Exponent of the symbol, e.g. "-1" for Hertz, namely "s-1".

real(kind=RKP), private :: factor_ =1._RKP

Symbol multiplicative scale factor (used only for converters).

real(kind=RKP), private :: offset_ =0._RKP

Symbol additive offset (used only for converters).

type(string), private :: symbol_

literal symbol, e.g. "m" for metres.


Type-Bound Procedures

procedure, public, pass(self) :: convert

Convert a magnitude with respect symbol definition.

  • private elemental function convert(self, magnitude, inverse) result(converted)

    Convert a magnitude with respect symbol definition.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: self

    The uom symbol.

    real(kind=RKP), intent(in) :: magnitude

    Magnitude to be converted.

    logical, intent(in), optional :: inverse

    Activate inverse conversion.

    Return Value real(kind=RKP)

    Converted magnitude.

procedure, public, pass(self) :: get_convert

Return the symbol generic conversion alias.

  • private subroutine get_convert(self, convert_)

    Return the symbol generic conversion alias.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: self

    The uom symbol.

    class(uom_converter), intent(out), allocatable:: convert_

    The symbol generic conversion alias.

procedure, public, pass(self) :: get_exponent

Return the symbol exponent.

  • private elemental function get_exponent(self) result(exponent_)

    Return the symbol exponent.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: self

    The uom symbol.

    Return Value integer(kind=IKP)

    The symbol exponent.

procedure, public, pass(self) :: get_factor

Return the symbol factor.

  • private elemental function get_factor(self) result(factor_)

    Return the symbol factor.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: self

    The uom symbol.

    Return Value real(kind=RKP)

    The symbol factor.

procedure, public, pass(self) :: get_offset

Return the symbol offset.

  • private elemental function get_offset(self) result(offset_)

    Return the symbol offset.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: self

    The uom symbol.

    Return Value real(kind=RKP)

    The symbol offset.

procedure, public, pass(self) :: get_symbol

Return the literal symbol.

  • private elemental function get_symbol(self) result(symbol_)

    Return the literal symbol.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: self

    The uom symbol.

    Return Value type(string)

    The literal symbol.

procedure, public, pass(self) :: is_defined

Check if the symbol is defined.

  • private elemental function is_defined(self)

    Check if uom_symbol is defined.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: self

    The uom symbol.

    Return Value logical

    Check result.

procedure, public, pass(self) :: parse

Parse symbol from string.

  • private subroutine parse(self, source)

    Parse symbol definition from string.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(inout) :: self

    The uom symbol.

    character(len=*), intent(in) :: source

    Source input string definition of symbol.

procedure, public, pass(self) :: prefixed

Return a prefixed symbol.

  • private elemental function prefixed(self, prefix)

    Return a prefixed symbol.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: self

    The uom symbol.

    type(uom_symbol), intent(in) :: prefix

    Other symbol used for prefixing.

    Return Value type(uom_symbol)

    The prefixed symbol.

procedure, public, pass(self) :: set

Set symbol.

  • private elemental subroutine set(self, symbol_, exponent_, factor_, offset_, convert_)

    Set symbol.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(inout) :: self

    The uom symbol.

    character(len=*), intent(in), optional :: symbol_

    literal symbol of the unit, e.g. "m" for metres.

    integer(kind=IKP), intent(in), optional :: exponent_

    Exponent of the symbol, e.g. "-1" for Hertz, namely "s-1".

    real(kind=RKP), intent(in), optional :: factor_

    Symbol multiplicative scale factor (used only for converters).

    real(kind=RKP), intent(in), optional :: offset_

    Symbol additive offset (used only for converters).

    class(uom_converter), intent(in), optional :: convert_

    Generic conversion alias formula user-supplied.

procedure, public, pass(self) :: stringify

Return a string representaion of the symbol.

  • private pure function stringify(self, compact_reals) result(raw)

    Return a string representation of uom_symbol.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: self

    The uom symbol.

    logical, intent(in), optional :: compact_reals

    Flag to activate real numbers compacting.

    Return Value character(len=:), allocatable

    Raw characters data.

procedure, public, pass(self) :: unset

Unset symbol.

  • private elemental subroutine unset(self)

    Unset symbol.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(inout) :: self

    The uom symbol.

generic, public :: assignment(=) => assign_uom_symbol

Overloading = assignment.

  • private pure subroutine assign_uom_symbol(lhs, rhs)

    uom_symbol = uom_symbol assignment.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(inout) :: lhs

    Left hand side.

    type(uom_symbol), intent(in) :: rhs

    Right hand side.

generic, public :: operator(/) => div

Overloading / operator.

  • private pure function div(lhs, rhs) result(opr)

    uom_symbol / uom_symbol operator.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: lhs

    Left hand side.

    type(uom_symbol), intent(in) :: rhs

    Right hand side.

    Return Value type(uom_symbol)

    Operator result.

generic, public :: operator(*) => mul

Overloading * operator.

  • private pure function mul(lhs, rhs) result(opr)

    uom_symbol * uom_symbol operator.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: lhs

    Left hand side.

    type(uom_symbol), intent(in) :: rhs

    Right hand side.

    Return Value type(uom_symbol)

    Operator result.

generic, public :: operator(**) => pow_R8P, pow_R4P, pow_I8P, pow_I4P, pow_I2P, pow_I1P

Overloading ** operator.

  • private pure function pow_R8P(lhs, rhs) result(opr)

    uom_symbol ** real(R8P) operator.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: lhs

    Left hand side.

    real(kind=R8P), intent(in) :: rhs

    Right hand side.

    Return Value type(uom_symbol)

    Operator result.

  • private pure function pow_R4P(lhs, rhs) result(opr)

    uom_symbol ** real(R4P) operator.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: lhs

    Left hand side.

    real(kind=R4P), intent(in) :: rhs

    Right hand side.

    Return Value type(uom_symbol)

    Operator result.

  • private pure function pow_I8P(lhs, rhs) result(opr)

    uom_symbol ** integer(I8P) operator.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: lhs

    Left hand side.

    integer(kind=I8P), intent(in) :: rhs

    Right hand side.

    Return Value type(uom_symbol)

    Operator result.

  • private pure function pow_I4P(lhs, rhs) result(opr)

    uom_symbol ** integer(I4P) operator.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: lhs

    Left hand side.

    integer(kind=I4P), intent(in) :: rhs

    Right hand side.

    Return Value type(uom_symbol)

    Operator result.

  • private pure function pow_I2P(lhs, rhs) result(opr)

    uom_symbol ** integer(I2P) operator.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: lhs

    Left hand side.

    integer(kind=I2P), intent(in) :: rhs

    Right hand side.

    Return Value type(uom_symbol)

    Operator result.

  • private pure function pow_I1P(lhs, rhs) result(opr)

    uom_symbol ** integer(I1P) operator.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: lhs

    Left hand side.

    integer(kind=I1P), intent(in) :: rhs

    Right hand side.

    Return Value type(uom_symbol)

    Operator result.

generic, public :: operator(==) => is_equal

Overloading == operator.

  • private elemental function is_equal(self, other)

    Check if uom_symbol is equal with another one.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: self

    The uom symbol.

    type(uom_symbol), intent(in) :: other

    The other symbol.

    Return Value logical

    Check result.

generic, public :: operator(.compatible.) => is_compatible

Definition of .compatible. operator.

  • private elemental function is_compatible(self, other)

    Check if uom_symbol is compatible with another one.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: self

    The uom symbol.

    type(uom_symbol), intent(in) :: other

    The other symbol.

    Return Value logical

    Check result.

generic, public :: operator(.convertible.) => is_convertible

Definition of .convertible. operator.

  • private elemental function is_convertible(self, other)

    Check if uom_symbol is convertible with another one.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: self

    The uom symbol.

    type(uom_symbol), intent(in) :: other

    The other symbol.

    Return Value logical

    Check result.

procedure, private, pass(self) :: is_compatible

Check if the symbol is compatible with another one.

  • private elemental function is_compatible(self, other)

    Check if uom_symbol is compatible with another one.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: self

    The uom symbol.

    type(uom_symbol), intent(in) :: other

    The other symbol.

    Return Value logical

    Check result.

procedure, private, pass(self) :: is_convertible

Check if the symbol is convertible with another one.

  • private elemental function is_convertible(self, other)

    Check if uom_symbol is convertible with another one.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: self

    The uom symbol.

    type(uom_symbol), intent(in) :: other

    The other symbol.

    Return Value logical

    Check result.

procedure, private, pass(self) :: is_equal

Check if the symbol is equal with another one.

  • private elemental function is_equal(self, other)

    Check if uom_symbol is equal with another one.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: self

    The uom symbol.

    type(uom_symbol), intent(in) :: other

    The other symbol.

    Return Value logical

    Check result.

procedure, private, pass(lhs) :: assign_uom_symbol

uom_symbol = uom_symbol assignment.

  • private pure subroutine assign_uom_symbol(lhs, rhs)

    uom_symbol = uom_symbol assignment.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(inout) :: lhs

    Left hand side.

    type(uom_symbol), intent(in) :: rhs

    Right hand side.

procedure, private, pass(lhs) :: div

uom_symbol / uom_symbol operator.

  • private pure function div(lhs, rhs) result(opr)

    uom_symbol / uom_symbol operator.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: lhs

    Left hand side.

    type(uom_symbol), intent(in) :: rhs

    Right hand side.

    Return Value type(uom_symbol)

    Operator result.

procedure, private, pass(lhs) :: mul

uom_symbol * uom_symbol operator.

  • private pure function mul(lhs, rhs) result(opr)

    uom_symbol * uom_symbol operator.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: lhs

    Left hand side.

    type(uom_symbol), intent(in) :: rhs

    Right hand side.

    Return Value type(uom_symbol)

    Operator result.

procedure, private, pass(lhs) :: pow_R16P

uom_symbol ** real(R16P) operator.

  • private pure function pow_R16P(lhs, rhs) result(opr)

    uom_symbol ** real(R16P) operator.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: lhs

    Left hand side.

    real(kind=R16P), intent(in) :: rhs

    Right hand side.

    Return Value type(uom_symbol)

    Operator result.

procedure, private, pass(lhs) :: pow_R8P

uom_symbol ** real(R8P) operator.

  • private pure function pow_R8P(lhs, rhs) result(opr)

    uom_symbol ** real(R8P) operator.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: lhs

    Left hand side.

    real(kind=R8P), intent(in) :: rhs

    Right hand side.

    Return Value type(uom_symbol)

    Operator result.

procedure, private, pass(lhs) :: pow_R4P

uom_symbol ** real(R4P) operator.

  • private pure function pow_R4P(lhs, rhs) result(opr)

    uom_symbol ** real(R4P) operator.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: lhs

    Left hand side.

    real(kind=R4P), intent(in) :: rhs

    Right hand side.

    Return Value type(uom_symbol)

    Operator result.

procedure, private, pass(lhs) :: pow_I8P

uom_symbol ** integer(I8P) operator.

  • private pure function pow_I8P(lhs, rhs) result(opr)

    uom_symbol ** integer(I8P) operator.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: lhs

    Left hand side.

    integer(kind=I8P), intent(in) :: rhs

    Right hand side.

    Return Value type(uom_symbol)

    Operator result.

procedure, private, pass(lhs) :: pow_I4P

uom_symbol ** integer(I4P) operator.

  • private pure function pow_I4P(lhs, rhs) result(opr)

    uom_symbol ** integer(I4P) operator.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: lhs

    Left hand side.

    integer(kind=I4P), intent(in) :: rhs

    Right hand side.

    Return Value type(uom_symbol)

    Operator result.

procedure, private, pass(lhs) :: pow_I2P

uom_symbol ** integer(I2P) operator.

  • private pure function pow_I2P(lhs, rhs) result(opr)

    uom_symbol ** integer(I2P) operator.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: lhs

    Left hand side.

    integer(kind=I2P), intent(in) :: rhs

    Right hand side.

    Return Value type(uom_symbol)

    Operator result.

procedure, private, pass(lhs) :: pow_I1P

uom_symbol ** integer(I1P) operator.

  • private pure function pow_I1P(lhs, rhs) result(opr)

    uom_symbol ** integer(I1P) operator.

    Arguments

    Type IntentOptional AttributesName
    class(uom_symbol), intent(in) :: lhs

    Left hand side.

    integer(kind=I1P), intent(in) :: rhs

    Right hand side.

    Return Value type(uom_symbol)

    Operator result.