ESMF_ArraySpecSet Subroutine

public subroutine ESMF_ArraySpecSet(arrayspec, rank, typekind, keywordEnforcer, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_ArraySpec), intent(out) :: arrayspec
integer, intent(in) :: rank
type(ESMF_TypeKind_Flag), intent(in) :: typekind
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
integer, intent(out), optional :: rc

Source Code

  subroutine ESMF_ArraySpecSet(arrayspec, rank, typekind, keywordEnforcer, rc)
!
! !ARGUMENTS:
    type(ESMF_ArraySpec),     intent(out)           :: arrayspec
    integer,                  intent(in)            :: rank
    type(ESMF_TypeKind_Flag), intent(in)            :: typekind
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
    integer,                  intent(out), optional :: rc
!
! !STATUS:
! \begin{itemize}
! \item\apiStatusCompatibleVersion{5.2.0r}
! \end{itemize}
!
! !DESCRIPTION:
!   Creates a description of the data -- the typekind, the rank,
!   and the dimensionality.
!
!   The arguments are:
!   \begin{description}
!   \item[arrayspec]
!     The {\tt ESMF\_ArraySpec} to set.
!   \item[rank]
!     Array rank (dimensionality -- 1D, 2D, etc). Maximum allowed is 7D.
!   \item[typekind]
!     Array typekind.  See section \ref{const:typekind} for valid values.
!   \item[{[rc]}]
!     Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!   \end{description}
!
!EOP
!------------------------------------------------------------------------------
    ! initialize return code; assume routine not implemented
    if (present(rc)) rc = ESMF_RC_NOT_IMPL

    ! mark output as uninitialized    
    ESMF_INIT_SET_DELETED(arrayspec)

    ! set rank
    arrayspec%rank = rank
    if (rank < 1 .or. rank > ESMF_MAXDIM) then
      ! not a valid rank value
      call ESMF_LogSetError(rcToCheck=ESMF_RC_OBJ_BAD, &
        msg="bad value for rank", &
        ESMF_CONTEXT, rcToReturn=rc)
      return  ! bail out
    endif

    ! set typekind (do not need check because parameterized type)
    arrayspec%typekind = typekind
    
    ! mark output as successfully initialized
    ESMF_INIT_SET_DEFINED(arrayspec)

    ! return successfully
    if (present(rc)) rc = ESMF_SUCCESS

  end subroutine ESMF_ArraySpecSet