logicalToRealArray Function

public function logicalToRealArray(value, n) result(res)

Converts an array of logicals into an array of reals.

0 equals to false, everything else equals to true.

Arguments

Type IntentOptional Attributes Name
logical, intent(in) :: value(n)

The value to interpret as boolean

integer, intent(in) :: n

The number of values in the input array

Return Value real(kind=rk), (n)

The values interpreted as booleans


Source Code

  function logicalToRealArray(value,n) result(res)
    ! ------------------------------------------------------------------------ !
    !> The number of values in the input array
    integer, intent(in) :: n
    !> The value to interpret as boolean
    logical, intent(in) :: value(n)
    !> The values interpreted as booleans
    real(kind=rk) :: res(n)
    ! ------------------------------------------------------------------------ !

    res = numFalse
    where(value) res = numTrue

  end function logicalToRealArray