realToLogicalArray Function

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

Converts an array of reals into an array of logicals.

0 equals to false, everything else equals to true.

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(in) :: value(n)

The value to interpret as boolean

integer, intent(in) :: n

The number of values in the input array

Return Value logical, (n)

The values interpreted as booleans


Source Code

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

    do ii = 1, n
      res(ii) = .not. (value(ii) .feq. numFalse)
    end do

  end function realToLogicalArray