ESMF_AttributeGetAttPackStateLG Subroutine

private subroutine ESMF_AttributeGetAttPackStateLG(target, name, attpack, value, defaultvalue, attnestflag, isPresent, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_State), intent(in) :: target
character(len=*), intent(in) :: name
type(ESMF_AttPack), intent(inout) :: attpack
logical, intent(out) :: value
logical, intent(in), optional :: defaultvalue
type(ESMF_AttNest_Flag), intent(in), optional :: attnestflag
logical, intent(out), optional :: isPresent
integer, intent(out), optional :: rc

Calls

proc~~esmf_attributegetattpackstatelg~~CallsGraph proc~esmf_attributegetattpackstatelg ESMF_AttributeGetAttPackStateLG interface~esmf_infoget ESMF_InfoGet proc~esmf_attributegetattpackstatelg->interface~esmf_infoget proc~attpack_formatkey ESMF_AttPack%attpack_formatKey proc~esmf_attributegetattpackstatelg->proc~attpack_formatkey proc~attpack_getpayload ESMF_AttPack%attpack_getPayload proc~esmf_attributegetattpackstatelg->proc~attpack_getpayload proc~esmf_imerr ESMF_IMErr proc~esmf_attributegetattpackstatelg->proc~esmf_imerr proc~esmf_infogetarraymeta ESMF_InfoGetArrayMeta proc~esmf_attributegetattpackstatelg->proc~esmf_infogetarraymeta proc~esmf_infoispresent ESMF_InfoIsPresent proc~esmf_attributegetattpackstatelg->proc~esmf_infoispresent proc~esmf_logfounderror ESMF_LogFoundError proc~esmf_attributegetattpackstatelg->proc~esmf_logfounderror proc~esmf_logwrite ESMF_LogWrite proc~esmf_attributegetattpackstatelg->proc~esmf_logwrite proc~esmf_stategetinit ESMF_StateGetInit proc~esmf_attributegetattpackstatelg->proc~esmf_stategetinit

Called by

proc~~esmf_attributegetattpackstatelg~~CalledByGraph proc~esmf_attributegetattpackstatelg ESMF_AttributeGetAttPackStateLG interface~esmf_attributeget ESMF_AttributeGet interface~esmf_attributeget->proc~esmf_attributegetattpackstatelg proc~checkcomponentattribute checkComponentAttribute proc~checkcomponentattribute->interface~esmf_attributeget proc~checkfieldattribute checkFieldAttribute proc~checkfieldattribute->interface~esmf_attributeget proc~checkstateattribute checkStateAttribute proc~checkstateattribute->interface~esmf_attributeget proc~nuopc_checkcplcomponentattribute NUOPC_CheckCplComponentAttribute proc~nuopc_checkcplcomponentattribute->interface~esmf_attributeget proc~nuopc_checkfieldattribute NUOPC_CheckFieldAttribute proc~nuopc_checkfieldattribute->interface~esmf_attributeget proc~nuopc_checkgridcomponentattribute NUOPC_CheckGridComponentAttribute proc~nuopc_checkgridcomponentattribute->interface~esmf_attributeget proc~nuopc_checkstateattribute NUOPC_CheckStateAttribute proc~nuopc_checkstateattribute->interface~esmf_attributeget proc~nuopc_cplcompattributeege NUOPC_CplCompAttributeEge proc~nuopc_cplcompattributeege->interface~esmf_attributeget proc~nuopc_cplcompsearchphasemapbyindex NUOPC_CplCompSearchPhaseMapByIndex proc~nuopc_cplcompsearchphasemapbyindex->interface~esmf_attributeget proc~nuopc_gridcompattributeege NUOPC_GridCompAttributeEge proc~nuopc_gridcompattributeege->interface~esmf_attributeget proc~nuopc_gridcompsearchphasemapbyindex NUOPC_GridCompSearchPhaseMapByIndex proc~nuopc_gridcompsearchphasemapbyindex->interface~esmf_attributeget proc~user_init~15 user_init proc~user_init~15->interface~esmf_attributeget proc~user_init~39 user_init proc~user_init~39->interface~esmf_attributeget proc~user_init~79 user_init proc~user_init~79->interface~esmf_attributeget proc~user_init~82 user_init proc~user_init~82->interface~esmf_attributeget program~attributeupdatereconcile AttributeUpdateReconcile program~attributeupdatereconcile->interface~esmf_attributeget program~esmf_arraycreategetutest ESMF_ArrayCreateGetUTest program~esmf_arraycreategetutest->interface~esmf_attributeget program~esmf_attributeprofileutest ESMF_AttributeProfileUTest program~esmf_attributeprofileutest->interface~esmf_attributeget program~esmf_attributeutilutest ESMF_AttributeUtilUTest program~esmf_attributeutilutest->interface~esmf_attributeget program~esmf_infosyncutest ESMF_InfoSyncUTest program~esmf_infosyncutest->interface~esmf_attributeget program~esmf_statereconcileutest ESMF_StateReconcileUTest program~esmf_statereconcileutest->interface~esmf_attributeget interface~nuopc_checkcomponentattribute NUOPC_CheckComponentAttribute interface~nuopc_checkcomponentattribute->proc~nuopc_checkcplcomponentattribute interface~nuopc_checkcomponentattribute->proc~nuopc_checkgridcomponentattribute interface~nuopc_compattributeegest NUOPC_CompAttributeEgest interface~nuopc_compattributeegest->proc~nuopc_cplcompattributeege interface~nuopc_compattributeegest->proc~nuopc_gridcompattributeege interface~nuopc_compsearchphasemapbyindex NUOPC_CompSearchPhaseMapByIndex interface~nuopc_compsearchphasemapbyindex->proc~nuopc_cplcompsearchphasemapbyindex interface~nuopc_compsearchphasemapbyindex->proc~nuopc_gridcompsearchphasemapbyindex proc~checkcomponentmetadata checkComponentMetadata proc~checkcomponentmetadata->proc~checkcomponentattribute proc~checkfieldmetaafteradvertise checkFieldMetaAfterAdvertise proc~checkfieldmetaafteradvertise->proc~nuopc_checkfieldattribute proc~checkfieldmetaafterrealize checkFieldMetaAfterRealize proc~checkfieldmetaafterrealize->proc~nuopc_checkfieldattribute proc~checkfieldmetadata checkFieldMetadata proc~checkfieldmetadata->proc~checkfieldattribute proc~checkstate checkState proc~checkstate->proc~checkstateattribute proc~nuopc_checkstate NUOPC_CheckState proc~nuopc_checkstate->proc~nuopc_checkstateattribute

Source Code

subroutine ESMF_AttributeGetAttPackStateLG(target, name, attpack, value, defaultvalue, attnestflag, isPresent, rc)
  ! 39.11.7
  type(ESMF_State), intent(in) :: target
  character(len=*), intent(in) :: name
  type(ESMF_AttPack), intent(inout) :: attpack
  logical, intent(out) :: value
  logical, intent(in), optional :: defaultvalue
  type(ESMF_AttNest_Flag), intent(in), optional :: attnestflag
  logical, intent(out), optional :: isPresent
  integer, intent(out), optional :: rc

  integer :: localrc
  character(:), allocatable :: key
  type(ESMF_AttNest_Flag) :: local_attnestflag
  logical :: debug = .false.
  integer :: size
  logical :: is_array, local_isPresent

  localrc = ESMF_FAILURE
  if (present(rc)) rc = ESMF_RC_NOT_IMPL
  ! Check object initialization
  ESMF_INIT_CHECK_DEEP(ESMF_StateGetInit, 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 (debug) then
    call ESMF_LogWrite(ESMF_METHOD//": key="//TRIM(key), rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return
  end if

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

  if (present(isPresent)) then
    isPresent = local_isPresent
  endif

  ! For Attribute, we support scalar to array stuff for single element arrays.
  ! Check if the target is an array with size 1. Operate on it as if it were a
  ! scalar.
  if (local_isPresent) then
    call ESMF_InfoGetArrayMeta(attpack%getPayload(), key, is_array, size, &
      attnestflag=local_attnestflag, rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return
  else
    ! Supply some default values for array and size checks to allow logical test
    ! for scalar-array implicit conversion.
    is_array = .false.
    size = 0
  endif

  if (local_isPresent .and. is_array .and. size==1) then
    call ESMF_InfoGet(attpack%getPayload(), key, value, idx=1, default=defaultvalue, &
      attnestflag=local_attnestflag, rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return
  else
    call ESMF_InfoGet(attpack%getPayload(), key, value, default=defaultvalue, &
      attnestflag=local_attnestflag, rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return
  end if

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