subroutine ESMF_InfoGetArrayR8Alloc(info, key, values, keywordEnforcer, itemCount, attnestflag, scalarToArray, rc)
type(ESMF_Info), intent(in) :: info
character(len=*), intent(in) :: key
real(ESMF_KIND_R8), dimension(:), allocatable, intent(out) :: values
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
integer, intent(out), optional :: itemCount
type(ESMF_AttNest_Flag), intent(in), optional :: attnestflag
logical, intent(in), optional :: scalarToArray
integer, intent(out), optional :: rc
integer :: localrc
integer(C_INT) :: recursive, local_itemCount, expected_size, local_scalarToArray
logical :: is_array
localrc = ESMF_FAILURE
if (present(rc)) rc = ESMF_FAILURE
recursive = 0 !false
if (present(attnestflag)) then
if (attnestflag%value==ESMF_ATTNEST_ON%value) recursive = 1 !true
end if
local_scalarToArray = 0 !false
if (present(scalarToArray)) then
if (scalarToArray) local_scalarToArray = 1 !true
end if
! Set the value to a negative one to indicate we are doing an allocatable call
! into the storage layer, and the size should not be checked.
expected_size = -1
! Get the array size from the info store
call ESMF_InfoGetArrayMeta(info, key, is_array, local_itemcount, attnestflag=attnestflag, &
rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return
! Allocate the outgoing storage array and call into C to fill the array
allocate(values(local_itemCount))
call c_info_get_array_R8(&
info%ptr, &
trim(key)//C_NULL_CHAR, &
values, &
local_itemCount, &
localrc, &
recursive, &
local_scalarToArray, &
expected_size)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return
if (present(itemCount)) itemCount = local_itemCount
if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_InfoGetArrayR8Alloc