subroutine ESMF_AttributeGetObjFieldR4List(target, name, valueList, defaultvalueList, convention, purpose, attnestflag, itemcount, isPresent, rc)
type(ESMF_Field), intent(in) :: target
character(len=*), intent(in) :: name
real(ESMF_KIND_R4), dimension(:), intent(out) :: valueList
real(ESMF_KIND_R4), dimension(:), intent(in), optional :: defaultvalueList
character(len=*), intent(in), optional :: convention
character(len=*), intent(in), optional :: purpose
type(ESMF_AttNest_Flag), intent(in), optional :: attnestflag
integer, intent(out), optional :: itemcount
logical, intent(out), optional :: isPresent
integer, intent(out), optional :: rc
integer :: localrc, ii, local_itemcount
logical :: local_isPresent
character(:), allocatable :: key
type(ESMF_Info) :: info
type(ESMF_InfoDescribe) :: eidesc
type(ESMF_AttNest_Flag) :: local_attnestflag
localrc = ESMF_FAILURE
if (present(rc)) rc = ESMF_RC_NOT_IMPL
! Check object initialization
ESMF_INIT_CHECK_DEEP(ESMF_FieldGetInit, target, rc)
if (present(attnestflag)) then
local_attnestflag = attnestflag
else
local_attnestflag = ESMF_ATTR_DEFAULT_ATTNEST
end if
call ESMF_InfoFormatKey(key, name, localrc, convention=convention, purpose=purpose)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return
info = eidesc%GetInfo(target, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return
local_isPresent = ESMF_InfoIsPresent(info, key, isPointer=.true., attnestflag=local_attnestflag, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return
if (present(isPresent)) isPresent = local_isPresent
if (present(defaultvalueList)) then
if (SIZE(defaultvalueList) /= SIZE(valueList)) then
if (ESMF_LogFoundError(ESMF_RC_ATTR_ITEMSOFF, msg="SIZE(defaultvalueList) /= SIZE(valueList)", ESMF_CONTEXT, rcToReturn=rc)) return
endif
endif
if (local_isPresent) then
call ESMF_InfoGet(info, key, valueList, itemcount=local_itemcount, attnestflag=local_attnestflag, scalarToArray=.true., rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return
if (present(itemcount)) itemcount = local_itemcount
else
if (present(defaultvalueList)) then
do ii=1,size(defaultvalueList)
valueList(ii) = defaultvalueList(ii)
enddo
if (present(itemcount)) itemcount = size(defaultvalueList)
else
if (present(itemcount)) itemcount = 0
if (ESMF_LogFoundError(ESMF_RC_ATTR_NOTSET, msg="The key '"//trim(name)//"' is not present and no default value is provided", &
ESMF_CONTEXT, rcToReturn=rc)) return
endif
endif
deallocate(key)
if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_AttributeGetObjFieldR4List