Converts an array of logicals into an array of reals.
0 equals to false, everything else equals to true.
Type | Intent | Optional | 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 |
The values interpreted as booleans
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