subroutine updateWithField(self, target, root_key, keywordEnforcer, rc)
class(ESMF_InfoDescribe), intent(inout) :: self
type(ESMF_Field), target, intent(in) :: target
character(*), intent(in) :: root_key
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
integer, intent(inout), optional :: rc
character(ESMF_MAXSTR) :: name
integer :: localrc
character(*), parameter :: etype="Field"
character(:), allocatable :: uname
if (present(rc)) rc = ESMF_RC_NOT_IMPL
call ESMF_FieldGet(target, name=name, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return
call self%updateGeneric(root_key, name, etype, target%ftypep%base, uname=uname, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return
if (self%found) then
! if (associated(self%foundField)) then
! if (ESMF_LogFoundError(ESMF_FAILURE, msg="Field already found", ESMF_CONTEXT, rcToReturn=rc)) return
! end if
self%foundField = target
! The target has been found. Do not search anymore.
nullify(self%searchCriteria)
self%found = .false.
end if
if (self%createInfo) then
call self%FillMembers(target, root_key//"/"//uname//"/members", rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return
deallocate(uname)
endif
if (present(rc)) rc = ESMF_SUCCESS
end subroutine updateWithField