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


Called by

proc~~logicaltoreal~~CalledByGraph proc~logicaltoreal logicalToReal proc~evallogicaland_forelement evalLogicalAnd_forElement proc~evallogicaland_forelement->proc~logicaltoreal proc~evallogicalequal_forelement evalLogicalEqual_forElement proc~evallogicalequal_forelement->proc~logicaltoreal proc~evallogicalgreater_forelement evalLogicalGreater_forElement proc~evallogicalgreater_forelement->proc~logicaltoreal proc~evallogicalgreaterorequal_forelement evalLogicalGreaterOrEqual_forElement proc~evallogicalgreaterorequal_forelement->proc~logicaltoreal proc~evallogicalless_forelement evalLogicalLess_forElement proc~evallogicalless_forelement->proc~logicaltoreal proc~evallogicallessorequal_forelement evalLogicalLessOrEqual_forElement proc~evallogicallessorequal_forelement->proc~logicaltoreal proc~evallogicalnotequal_forelement evalLogicalNotEqual_forElement proc~evallogicalnotequal_forelement->proc~logicaltoreal proc~evallogicalor_forelement evalLogicalOr_forElement proc~evallogicalor_forelement->proc~logicaltoreal

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