ESMF_AttributeGetInfoByNamAPGrid Subroutine

private subroutine ESMF_AttributeGetInfoByNamAPGrid(target, name, attpack, keywordEnforcer, attnestflag, typekind, itemCount, isPresent, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Grid), intent(in) :: target
character(len=*), intent(in) :: name
type(ESMF_AttPack), intent(inout) :: attpack
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
type(ESMF_AttNest_Flag), intent(in), optional :: attnestflag
type(ESMF_TypeKind_Flag), intent(out), optional :: typekind
integer, intent(out), optional :: itemCount
logical, intent(out), optional :: isPresent
integer, intent(out), optional :: rc

Source Code

subroutine ESMF_AttributeGetInfoByNamAPGrid(target, name, attpack, keywordEnforcer, attnestflag, typekind, itemCount, isPresent, rc)
  ! 39.11.16
  type(ESMF_Grid), intent(in) :: target
  character(len=*), intent(in) :: name
  type(ESMF_AttPack), intent(inout) :: attpack
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer ! must use keywords below
  type(ESMF_AttNest_Flag), intent(in), optional :: attnestflag
  type(ESMF_TypeKind_Flag), intent(out), optional :: typekind
  integer, intent(out), optional :: itemCount
  logical, intent(out), optional :: isPresent
  integer, intent(out), optional :: rc

  integer :: countSingle, localrc
  character(:), allocatable :: key
  logical :: is_present, is_structured, is_null
  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_GridGetInit, target, rc)

  if (present(attnestflag)) then
    local_attnestflag = attnestflag
  else
    local_attnestflag = ESMF_ATTR_DEFAULT_ATTNEST
  end if

  key = attpack%formatKey(name=name, rc=localrc)
  if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return

  if (.not. present(typekind) .and. .not. present(itemCount) .and. .not. present(isPresent)) then
    if (ESMF_LogFoundError(ESMF_RC_ATTR_NOTSET, msg="Missing query argument. Nothing to do", ESMF_CONTEXT, rcToReturn=rc)) return
  end if

  is_present = ESMF_InfoIsPresent(attpack%getPayload(), key, attnestflag=local_attnestflag, &
    rc=localrc)
  if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return

  if (present(isPresent)) isPresent = is_present

  if (is_present) then
    call ESMF_InfoGet(attpack%getPayload(), key=key, size=itemCount, attnestflag=local_attnestflag, &
      typekind=typekind, isStructured=is_structured, isNull=is_null, attrCompliance=.true., &
      rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return
    if (.not. is_structured) then
      if (present(itemCount)) then
        if (is_null) then
          itemCount = 0
        else
          itemCount = 1
        endif
      end if
    end if
  else
    if (present(itemCount)) itemCount = 0
    if (present(typekind)) typekind = ESMF_NOKIND
  end if

  if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_AttributeGetInfoByNamAPGrid