to_real Subroutine

private pure elemental subroutine to_real(str, val, status_ok)

Convert a string to a real(wp)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: str
real(kind=wp), intent(out) :: val
logical, intent(out) :: status_ok

Called by

proc~~to_real~~CalledByGraph proc~to_real namelist_parser_module::to_real proc~add_variable namelist_parser_module::add_variable proc~add_variable->proc~to_real proc~parse_namelist namelist_parser_module::parse_namelist proc~parse_namelist->proc~add_variable

Source Code

    pure elemental subroutine to_real(str,val,status_ok)

    implicit none

    character(len=*),intent(in) :: str
    real(wp),intent(out) :: val
    logical,intent(out) :: status_ok

    integer :: istat  !! read `iostat` error code

    read(str,fmt=*,iostat=istat) val
    if (istat==0) then
        status_ok = .true.
    else
        status_ok = .false.
        val = 0.0_wp
    end if

    end subroutine to_real