ESMF_AttributeReadGrid Subroutine

private subroutine ESMF_AttributeReadGrid(target, fileName, keywordEnforcer, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Grid), intent(inout) :: target
character(len=*), intent(in) :: fileName
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
integer, intent(out), optional :: rc

Source Code

subroutine ESMF_AttributeReadGrid(target, filename, keywordenforcer, rc)
  ! 39.11.32 - removed schemaFileName
  type(ESMF_Grid), intent(inout) :: target
  character(len=*), intent(in) :: fileName
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer ! must use keywords below
  integer, intent(out), optional :: rc

  integer :: localrc
  type(ESMF_InfoDescribe) :: eidesc
  type(ESMF_Info) :: isrc, idst

  localrc = ESMF_FAILURE
  if (present(rc)) rc = ESMF_RC_NOT_IMPL
  ! Check object initialization
  ESMF_INIT_CHECK_DEEP(ESMF_GridGetInit, target, rc)

  isrc = ESMF_InfoReadJSON(filename, rc=localrc)
  if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return

  idst = eidesc%GetInfo(target, rc=localrc)
  if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return

  call ESMF_InfoDestroy(idst, rc=localrc)
  if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=rc)) return

  idst%ptr = isrc%ptr

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