subroutine ESMF_ConfigGetFloatR8(config, value, &
keywordEnforcer, label, default, rc)
! !ARGUMENTS:
type(ESMF_Config), intent(inout) :: config
real(ESMF_KIND_R8), intent(out) :: value
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
character(len=*), intent(in), optional :: label
real(ESMF_KIND_R8), intent(in), optional :: default
integer, intent(out), optional :: rc
!
! !DESCRIPTION:
! Gets an 8-byte real {\tt value} from the {\tt config} object.
!
! The arguments are:
! \begin{description}
! \item [config]
! Already created {\tt ESMF\_Config} object.
! \item [value]
! Returned real value.
! \item [{[label]}]
! Identifying label.
! \item [{[default]}]
! Default value if {\tt label} is not found in {\tt config} object.
! \item [{[rc]}]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOPI -------------------------------------------------------------------
!
integer :: localrc
integer :: iostat
character(len=LSZ) :: string
real(ESMF_KIND_R8) :: x
! Initialize return code; assume routine not implemented
if (present(rc)) rc = ESMF_RC_NOT_IMPL
localrc = ESMF_RC_NOT_IMPL
!check variables
ESMF_INIT_CHECK_DEEP(ESMF_ConfigGetInit,config,rc)
! Default setting
if( present( default ) ) then
value = default
else
value = 0.0
endif
! Processing
if (present (label ) ) then
call ESMF_ConfigGetString( config, string, label=label, rc=localrc)
else
call ESMF_ConfigGetString( config, string, rc = localrc )
endif
if ( localrc == ESMF_SUCCESS ) then
read(string,*,iostat=iostat) x
if (iostat == 0) then
call ESMF_ConfigSetCurrentAttrUsed(config, used=.true.)
else
! undo what GetSring() did
call ESMF_ConfigSetCurrentAttrUsed(config, used=.false.)
localrc = ESMF_RC_VAL_OUTOFRANGE
endif
else
if( present( default )) then
x = default
localrc = ESMF_SUCCESS
endif
end if
if ( localrc == ESMF_SUCCESS ) then
value = x
endif
if( present( rc )) then
rc = localrc
endif
end subroutine ESMF_ConfigGetFloatR8