subroutine ESMF_InfoGetArrayLG(info, key, values, keywordEnforcer, itemCount, attnestflag, scalarToArray, rc)
type(ESMF_Info), intent(in) :: info
character(len=*), intent(in) :: key
logical, dimension(:), 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
integer :: ii
logical(C_BOOL), dimension(:), allocatable :: local_values
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
! This is used to validate the size of the outgoing array given the size in
! storage.
expected_size = size(values)
! Store boolean integers for transfer from C
allocate(local_values(SIZE(values)))
call c_info_get_array_LG(&
info%ptr, &
trim(key)//C_NULL_CHAR, &
local_values, &
local_itemCount, &
localrc, &
recursive, &
local_scalarToArray, &
expected_size)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return
! Transfer to logical storage from boolean integers
do ii=1,SIZE(values)
values(ii) = local_values(ii)
enddo
deallocate(local_values)
if (present(itemCount)) itemCount = local_itemCount
if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_InfoGetArrayLG