uom_reference Derived Type

type, public :: uom_reference

type~~uom_reference~2~~InheritsGraph type~uom_reference~2 uom_reference type~uom_symbol~2 uom_symbol type~uom_symbol~2->type~uom_reference~2 aliases, dimensions type~uom_converter uom_converter type~uom_converter->type~uom_symbol~2 convert_ type~string string type~string->type~uom_symbol~2 symbol_
Help


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.

Inherited By

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

Components

TypeVisibility AttributesNameInitial
type(uom_symbol), private, allocatable:: aliases(:)

Uom symbol aliases, e.g. "m = meter = metre" for metres.

integer(kind=I_P), private :: aliases_number =0_I_P

Number of defined symbol aliases.

type(uom_symbol), private :: dimensions

Dimensions of the symbol, e.g. "length" for meter.


Constructor

public interface uom_reference

Overloading uom_reference name with a creator function.

  • private function creator_from_string(source) result(reference)

    Create an instance of uom_reference.

    Arguments

    Type IntentOptional AttributesName
    character(len=*), intent(in) :: source

    Source input string definition of the symbol.

    Return Value type(uom_reference)

    The uom reference.


Type-Bound Procedures

procedure, public, pass(self) :: dimensionality

Return a string representation of the symbol dimensions.

  • private pure function dimensionality(self) result(raw)

    Return a string representation of uom_reference dimensions.

    Arguments

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

    The uom reference.

    Return Value character(len=:), allocatable

    Raw characters data.

procedure, public, pass(self) :: get_aliases

Return the aliases list.

  • private pure subroutine get_aliases(self, aliases)

    Return the aliases list.

    Arguments

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

    The uom reference.

    type(uom_symbol), intent(out), allocatable:: aliases(:)

    Aliases.

procedure, public, pass(self) :: get_dimensions

Return the dimensions.

  • private pure subroutine get_dimensions(self, dimensions)

    Return the dimensions.

    Arguments

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

    The uom reference.

    type(uom_symbol), intent(out) :: dimensions

    Dimensions.

procedure, public, pass(self) :: get_main_symbol

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

  • private pure function get_main_symbol(self) result(alias)

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

    Arguments

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

    The uom reference.

    Return Value type(uom_symbol)

    First compatible alias.

procedure, public, pass(self) :: is_defined

Check if the reference is defined.

  • private elemental function is_defined(self)

    Check if uom_reference is defined.

    Arguments

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

    The uom reference.

    Return Value logical

    Check result.

procedure, public, pass(self) :: parse

Parse reference from string.

  • private subroutine parse(self, source)

    Parse uom_reference definition from string.

    Arguments

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

    The uom reference.

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

    Source input string definition of symbol.

procedure, public, pass(self) :: prefixed

Return a prefixed reference.

  • private elemental function prefixed(self, prefixes)

    Return a prefixed reference.

    Arguments

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

    The uom reference.

    type(uom_reference), intent(in) :: prefixes

    Other reference used for prefixing.

    Return Value type(uom_reference)

    The prefixed reference.

procedure, public, pass(self) :: set

Set reference.

  • private pure subroutine set(self, aliases, dimensions)

    Set reference.

    Arguments

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

    The uom reference.

    type(uom_symbol), intent(in), optional :: aliases(1:)

    Reference aliases.

    type(uom_symbol), intent(in), optional :: dimensions

    Dimensions of the reference, e.g. "frequency" for Hz.

procedure, public, pass(self) :: set_alias_conversion

Set alias conversion formula.

  • private pure subroutine set_alias_conversion(self, alias_index, convert)

    Set alias conversion formula.

    Arguments

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

    The uom reference.

    integer(kind=I_P), intent(in) :: alias_index

    Index of the alias to which set the conversion formula.

    class(uom_converter), intent(in) :: convert

    Generic conversion alias formula user-supplied.

procedure, public, pass(self) :: stringify

Return a string representation of the reference.

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

    Return a string representation of uom_reference.

    Arguments

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

    The uom reference.

    logical, intent(in), optional :: with_dimensions

    Flag to activate dimensions printing.

    logical, intent(in), optional :: with_aliases

    Flag to activate aliases printing.

    logical, intent(in), optional :: protect_aliases

    Flag to activate aliases printing in protected mode.

    logical, intent(in), optional :: compact_reals

    Flag to activate real numbers compacting.

    Return Value character(len=:), allocatable

    Raw characters data.

procedure, public, pass(self) :: to

Convert magnitude with respect another alias.

  • private elemental subroutine to(self, other, magnitude, converted, is_found)

    Convert magnitude with respect another alias.

    Arguments

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

    The uom reference.

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

    Other unit reference used for conversion.

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

    Magnitude to be converted.

    real(kind=RKP), intent(out) :: converted

    Converted magnitude.

    logical, intent(out) :: is_found

    Flag to check if a conversion alias has been found.

procedure, public, pass(self) :: unset

Unset reference.

  • private elemental subroutine unset(self)

    Unset reference.

    Arguments

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

    The uom reference.

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

Overloading = assignment.

  • private pure subroutine assign_uom_reference(lhs, rhs)

    uom_reference = uom_reference assignment.

    Arguments

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

    Left hand side.

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

    Right hand side.

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

Overloading / operator.

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

    uom_reference / uom_reference operator.

    Arguments

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

    Left hand side.

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

    Right hand side.

    Return Value type(uom_reference)

    Operator result.

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

Overloading * operator.

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

    uom_reference * uom_reference operator.

    Arguments

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

    Left hand side.

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

    Right hand side.

    Return Value type(uom_reference)

    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_reference ** real(R8P) operator.

    Arguments

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

    Left hand side.

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

    Right hand side.

    Return Value type(uom_reference)

    Operator result.

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

    uom_reference ** real(R4P) operator.

    Arguments

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

    Left hand side.

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

    Right hand side.

    Return Value type(uom_reference)

    Operator result.

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

    uom_reference ** integer(I8P) operator.

    Arguments

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

    Left hand side.

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

    Right hand side.

    Return Value type(uom_reference)

    Operator result.

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

    uom_reference ** integer(I4P) operator.

    Arguments

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

    Left hand side.

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

    Right hand side.

    Return Value type(uom_reference)

    Operator result.

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

    uom_reference ** integer(I2P) operator.

    Arguments

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

    Left hand side.

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

    Right hand side.

    Return Value type(uom_reference)

    Operator result.

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

    uom_reference ** integer(I1P) operator.

    Arguments

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

    Left hand side.

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

    Right hand side.

    Return Value type(uom_reference)

    Operator result.

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

Overloading == operator.

  • private elemental function is_equal(self, other)

    Check if uom_reference is equal with another one.

    Arguments

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

    The uom reference.

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

    The other reference.

    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_reference is compatible with another one.

    Arguments

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

    The uom reference.

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

    The other reference.

    Return Value logical

    Check result.

procedure, private, pass(self) :: is_compatible

Check if the reference is compatible with another one.

  • private elemental function is_compatible(self, other)

    Check if uom_reference is compatible with another one.

    Arguments

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

    The uom reference.

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

    The other reference.

    Return Value logical

    Check result.

procedure, private, pass(self) :: is_equal

Check if the reference is equal with another one.

  • private elemental function is_equal(self, other)

    Check if uom_reference is equal with another one.

    Arguments

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

    The uom reference.

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

    The other reference.

    Return Value logical

    Check result.

procedure, private, pass(lhs) :: assign_uom_reference

uom_reference = uom_reference assignment.

  • private pure subroutine assign_uom_reference(lhs, rhs)

    uom_reference = uom_reference assignment.

    Arguments

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

    Left hand side.

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

    Right hand side.

procedure, private, pass(lhs) :: div

uom_reference / uom_reference operator.

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

    uom_reference / uom_reference operator.

    Arguments

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

    Left hand side.

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

    Right hand side.

    Return Value type(uom_reference)

    Operator result.

procedure, private, pass(lhs) :: mul

uom_reference * uom_reference operator.

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

    uom_reference * uom_reference operator.

    Arguments

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

    Left hand side.

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

    Right hand side.

    Return Value type(uom_reference)

    Operator result.

procedure, private, pass(lhs) :: pow_R16P

uom_reference ** real(R16P) operator.

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

    uom_reference ** real(R16P) operator.

    Arguments

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

    Left hand side.

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

    Right hand side.

    Return Value type(uom_reference)

    Operator result.

procedure, private, pass(lhs) :: pow_R8P

uom_reference ** real(R8P) operator.

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

    uom_reference ** real(R8P) operator.

    Arguments

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

    Left hand side.

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

    Right hand side.

    Return Value type(uom_reference)

    Operator result.

procedure, private, pass(lhs) :: pow_R4P

uom_reference ** real(R4P) operator.

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

    uom_reference ** real(R4P) operator.

    Arguments

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

    Left hand side.

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

    Right hand side.

    Return Value type(uom_reference)

    Operator result.

procedure, private, pass(lhs) :: pow_I8P

uom_reference ** integer(I8P) operator.

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

    uom_reference ** integer(I8P) operator.

    Arguments

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

    Left hand side.

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

    Right hand side.

    Return Value type(uom_reference)

    Operator result.

procedure, private, pass(lhs) :: pow_I4P

uom_reference ** integer(I4P) operator.

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

    uom_reference ** integer(I4P) operator.

    Arguments

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

    Left hand side.

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

    Right hand side.

    Return Value type(uom_reference)

    Operator result.

procedure, private, pass(lhs) :: pow_I2P

uom_reference ** integer(I2P) operator.

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

    uom_reference ** integer(I2P) operator.

    Arguments

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

    Left hand side.

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

    Right hand side.

    Return Value type(uom_reference)

    Operator result.

procedure, private, pass(lhs) :: pow_I1P

uom_reference ** integer(I1P) operator.

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

    uom_reference ** integer(I1P) operator.

    Arguments

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

    Left hand side.

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

    Right hand side.

    Return Value type(uom_reference)

    Operator result.