ESMF_InfoGetArrayR4 Subroutine

private subroutine ESMF_InfoGetArrayR4(info, key, values, keywordEnforcer, itemCount, attnestflag, scalarToArray, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Info), intent(in) :: info
character(len=*), intent(in) :: key
real(kind=ESMF_KIND_R4), intent(out), dimension(:) :: values
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
integer, intent(out), optional :: itemCount
type(ESMF_AttNest_Flag), intent(in), optional :: attnestflag
logical, intent(in), optional :: scalarToArray
integer, intent(out), optional :: rc

Source Code

subroutine ESMF_InfoGetArrayR4(info, key, values, keywordEnforcer, itemCount, attnestflag, scalarToArray, rc)
  type(ESMF_Info), intent(in) :: info
  character(len=*), intent(in) :: key
  real(ESMF_KIND_R4), 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

  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)

  call c_info_get_array_R4(&
    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_InfoGetArrayR4