logicalToReal Function

public function logicalToReal(value) result(res)

Converts a logical into a real.

0 equals to false, everything else equals to true.

Arguments

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

The value to interpret as boolean

Return Value real(kind=rk)

The value interpreted as boolean


Source Code

  function logicalToReal(value) result(res)
    ! ------------------------------------------------------------------------ !
    !> The value to interpret as boolean
    logical, intent(in) :: value
    !> The value interpreted as boolean
    real(kind=rk) :: res
    ! ------------------------------------------------------------------------ !

    if (value) then
      res = numTrue
    else
      res = numFalse
    end if

  end function logicalToReal