ESMF_AttributeGetCountAttPackMesh Subroutine

private subroutine ESMF_AttributeGetCountAttPackMesh(target, attpack, count, keywordEnforcer, attcountflag, attnestflag, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Mesh), intent(in) :: target
type(ESMF_AttPack), intent(inout) :: attpack
integer, intent(out) :: count
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
type(ESMF_AttGetCountFlag), intent(in), optional :: attcountflag
type(ESMF_AttNest_Flag), intent(in), optional :: attnestflag
integer, intent(out), optional :: rc

Source Code

subroutine ESMF_AttributeGetCountAttPackMesh(target, attpack, count, keywordEnforcer, attcountflag, attnestflag, rc)
  type(ESMF_Mesh), intent(in) :: target
  type(ESMF_AttPack), intent(inout) :: attpack
  integer, intent(out) :: count
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer ! must use keywords below
  type(ESMF_AttGetCountFlag), intent(in), optional :: attcountflag
  type(ESMF_AttNest_Flag), intent(in), optional :: attnestflag
  integer, intent(out), optional :: rc

  type(ESMF_AttGetCountFlag) :: l_attcountflag
  integer :: countSingle, countTotal, attPackCount, localrc
  character(:), allocatable :: key
  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_MeshGetInit, target, rc)

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

  call ESMF_InfoGet(attpack%getPayload(), key=attpack%formatKey(), attrCount=countSingle, &
    attrCountTotal=countTotal, attPackCount=attPackCount, attnestflag=local_attnestflag, &
    attrCompliance=.true., rc=localrc)
  if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return

  if (present(attcountflag)) then
    l_attcountflag = attcountflag
  else
    l_attcountflag = ESMF_ATTGETCOUNT_ATTRIBUTE
  end if

  if (l_attcountflag%value==ESMF_ATTGETCOUNT_ATTRIBUTE%value) then
    count = countSingle
  else if (l_attcountflag%value==ESMF_ATTGETCOUNT_TOTAL%value) then
    count = countTotal
  else if (l_attcountflag%value==ESMF_ATTGETCOUNT_ATTPACK%value) then
    count = attPackCount
  else
    if (ESMF_LogFoundError(ESMF_RC_ARG_BAD, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return
  end if

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