ESMF_GridSetCoordFromArray Subroutine

private subroutine ESMF_GridSetCoordFromArray(grid, coordDim, staggerloc, array, keywordEnforcer, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Grid), intent(in) :: grid
integer, intent(in) :: coordDim
type(ESMF_StaggerLoc), intent(in), optional :: staggerloc
type(ESMF_Array), intent(in) :: array
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
integer, intent(out), optional :: rc

Calls

proc~~esmf_gridsetcoordfromarray~~CallsGraph proc~esmf_gridsetcoordfromarray ESMF_GridSetCoordFromArray c_esmc_gridsetcoordfromarray c_esmc_gridsetcoordfromarray proc~esmf_gridsetcoordfromarray->c_esmc_gridsetcoordfromarray esmf_arraygetinit esmf_arraygetinit proc~esmf_gridsetcoordfromarray->esmf_arraygetinit proc~esmf_gridgetdecomptype ESMF_GridGetDecompType proc~esmf_gridsetcoordfromarray->proc~esmf_gridgetdecomptype proc~esmf_imerr ESMF_IMErr proc~esmf_gridsetcoordfromarray->proc~esmf_imerr proc~esmf_logfounderror ESMF_LogFoundError proc~esmf_gridsetcoordfromarray->proc~esmf_logfounderror proc~esmf_logseterror ESMF_LogSetError proc~esmf_gridsetcoordfromarray->proc~esmf_logseterror proc~esmf_gridgetdecomptype->proc~esmf_logfounderror c_esmc_gridgetdecomptype c_esmc_gridgetdecomptype proc~esmf_gridgetdecomptype->c_esmc_gridgetdecomptype proc~esmf_imerr->proc~esmf_logfounderror proc~esmf_initcheckdeep ESMF_InitCheckDeep proc~esmf_imerr->proc~esmf_initcheckdeep esmf_breakpoint esmf_breakpoint proc~esmf_logfounderror->esmf_breakpoint proc~esmf_logrc2msg ESMF_LogRc2Msg proc~esmf_logfounderror->proc~esmf_logrc2msg proc~esmf_logwrite ESMF_LogWrite proc~esmf_logfounderror->proc~esmf_logwrite proc~esmf_logseterror->esmf_breakpoint proc~esmf_logseterror->proc~esmf_logrc2msg proc~esmf_logseterror->proc~esmf_logwrite c_esmc_loggeterrormsg c_esmc_loggeterrormsg proc~esmf_logrc2msg->c_esmc_loggeterrormsg c_esmc_vmwtime c_esmc_vmwtime proc~esmf_logwrite->c_esmc_vmwtime proc~esmf_logclose ESMF_LogClose proc~esmf_logwrite->proc~esmf_logclose proc~esmf_logflush ESMF_LogFlush proc~esmf_logwrite->proc~esmf_logflush proc~esmf_logopenfile ESMF_LogOpenFile proc~esmf_logwrite->proc~esmf_logopenfile proc~esmf_utiliounitflush ESMF_UtilIOUnitFlush proc~esmf_logwrite->proc~esmf_utiliounitflush proc~esmf_utilstring2array ESMF_UtilString2Array proc~esmf_logwrite->proc~esmf_utilstring2array proc~esmf_logclose->proc~esmf_logflush proc~esmf_logflush->proc~esmf_utiliounitflush proc~esmf_utilarray2string ESMF_UtilArray2String proc~esmf_logflush->proc~esmf_utilarray2string proc~esmf_logopenfile->proc~esmf_utiliounitflush proc~esmf_utiliounitget ESMF_UtilIOUnitGet proc~esmf_logopenfile->proc~esmf_utiliounitget

Called by

proc~~esmf_gridsetcoordfromarray~~CalledByGraph proc~esmf_gridsetcoordfromarray ESMF_GridSetCoordFromArray interface~esmf_gridsetcoord ESMF_GridSetCoord interface~esmf_gridsetcoord->proc~esmf_gridsetcoordfromarray program~esmf_gridarbitraryutest ESMF_GridArbitraryUTest program~esmf_gridarbitraryutest->interface~esmf_gridsetcoord program~esmf_gridcoordutest ESMF_GridCoordUTest program~esmf_gridcoordutest->interface~esmf_gridsetcoord program~esmf_gridcreateex ESMF_GridCreateEx program~esmf_gridcreateex->interface~esmf_gridsetcoord

Source Code

      subroutine ESMF_GridSetCoordFromArray(grid, coordDim, staggerloc, &
        array, keywordEnforcer, rc)
!
! !ARGUMENTS:
      type(ESMF_Grid),        intent(in)            :: grid
      integer,                intent(in)            :: coordDim
      type (ESMF_StaggerLoc), intent(in),  optional :: staggerloc
      type(ESMF_Array),       intent(in)            :: array
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:
! This method sets the passed in Array as the holder of the coordinate
! data for stagger location staggerloc and coordinate coord. This method
! can be used in place of ESMF\_GridAddCoord(). In fact, if the Grid
! location already contains an Array for this coordinate, then this one
! replaces it. For this method to replace ESMF\_GridAddCoord() and produce
! a valid set of coordinates, then this method must be used to set
! an Array for each coordDim ranging from 1 to the dimCount of the passed in Grid.
!
!     The arguments are:
!\begin{description}
!\item[grid]
!    The grid to set the coord in.
!\item[coordDim]
!    The coordinate dimension to put the data in (e.g. 1=x).
!\item[{[staggerloc]}]
!    The stagger location into which to copy the arrays.
!    Please see Section~\ref{const:staggerloc} for a list
!    of predefined stagger locations. If not present, defaults to
!    ESMF\_STAGGERLOC\_CENTER.
!\item[array]
!    An array to set the grid coordinate information from.
!\item[{[rc]}]
!    Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!\end{description}
!
!EOP
    integer :: tmp_staggerloc
    integer :: localrc ! local error status
    type(ESMF_GridDecompType) :: decompType
    type(ESMF_DataCopy_Flag) :: datacopyflag


    ! Initialize return code; assume failure until success is certain
    localrc = ESMF_RC_NOT_IMPL
    if (present(rc)) rc = ESMF_RC_NOT_IMPL

    ! Check init status of arguments
    ESMF_INIT_CHECK_DEEP_SHORT(ESMF_ArrayGetInit, array, rc)
!    ESMF_INIT_CHECK_DEEP_SHORT(ESMF_GridGetInit, grid, rc)

    call ESMF_GridGetDecompType(grid, decompType, rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    ! handle staggerloc
    if (present(staggerloc)) then
       if ((decompType == ESMF_GRID_ARBITRARY) .and. &
          (staggerloc /= ESMF_STAGGERLOC_CENTER)) then
          call ESMF_LogSetError(rcToCheck=ESMF_RC_ARG_WRONG, &
                 msg="- staggerloc has to be ESMF_STAGGERLOC_CENTER for arbitrary grid", &
                 ESMF_CONTEXT, rcToReturn=rc)
           return
        else
                   tmp_staggerloc=staggerloc%staggerloc
        endif
    else
        tmp_staggerloc=ESMF_STAGGERLOC_CENTER%staggerloc
    endif

    ! Use reference
    datacopyflag=ESMF_DATACOPY_REFERENCE

    ! Call C++ Subroutine to do the create
    call c_ESMC_gridsetcoordfromarray(grid%this,tmp_staggerloc, coordDim, &
      array, datacopyflag, localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    if (present(rc)) rc = ESMF_SUCCESS

      end subroutine ESMF_GridSetCoordFromArray