ESMF_GridMatch Function

public function ESMF_GridMatch(grid1, grid2, keywordEnforcer, globalflag, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Grid), intent(in) :: grid1
type(ESMF_Grid), intent(in) :: grid2
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
logical, intent(in), optional :: globalflag
integer, intent(out), optional :: rc

Return Value type(ESMF_GridMatch_Flag)


Calls

proc~~esmf_gridmatch~~CallsGraph proc~esmf_gridmatch ESMF_GridMatch c_esmc_gridmatch c_esmc_gridmatch proc~esmf_gridmatch->c_esmc_gridmatch interface~esmf_vmallreduce ESMF_VMAllReduce proc~esmf_gridmatch->interface~esmf_vmallreduce interface~esmf_vmget ESMF_VMGet proc~esmf_gridmatch->interface~esmf_vmget proc~esmf_gridgetinit ESMF_GridGetInit proc~esmf_gridmatch->proc~esmf_gridgetinit proc~esmf_imerr ESMF_IMErr proc~esmf_gridmatch->proc~esmf_imerr proc~esmf_logfounderror ESMF_LogFoundError proc~esmf_gridmatch->proc~esmf_logfounderror proc~esmf_vmgetcurrent ESMF_VMGetCurrent proc~esmf_gridmatch->proc~esmf_vmgetcurrent proc~esmf_vmallreducei4 ESMF_VMAllReduceI4 interface~esmf_vmallreduce->proc~esmf_vmallreducei4 proc~esmf_vmallreducei4s ESMF_VMAllReduceI4S interface~esmf_vmallreduce->proc~esmf_vmallreducei4s proc~esmf_vmallreducei8 ESMF_VMAllReduceI8 interface~esmf_vmallreduce->proc~esmf_vmallreducei8 proc~esmf_vmallreducer4 ESMF_VMAllReduceR4 interface~esmf_vmallreduce->proc~esmf_vmallreducer4 proc~esmf_vmallreducer8 ESMF_VMAllReduceR8 interface~esmf_vmallreduce->proc~esmf_vmallreducer8 proc~esmf_vmgetdefault ESMF_VMGetDefault interface~esmf_vmget->proc~esmf_vmgetdefault proc~esmf_vmgetpetspecific ESMF_VMGetPetSpecific interface~esmf_vmget->proc~esmf_vmgetpetspecific 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_vmgetcurrent->proc~esmf_logfounderror c_esmc_vmgetcurrent c_esmc_vmgetcurrent proc~esmf_vmgetcurrent->c_esmc_vmgetcurrent

Called by

proc~~esmf_gridmatch~~CalledByGraph proc~esmf_gridmatch ESMF_GridMatch proc~esmf_xgridgeombasematch ESMF_XGridGeomBaseMatch proc~esmf_xgridgeombasematch->proc~esmf_gridmatch program~esmf_gridcoordutest ESMF_GridCoordUTest program~esmf_gridcoordutest->proc~esmf_gridmatch program~esmf_gridcreateutest ESMF_GridCreateUTest program~esmf_gridcreateutest->proc~esmf_gridmatch program~esmf_griditemutest ESMF_GridItemUTest program~esmf_griditemutest->proc~esmf_gridmatch proc~esmf_xgridmatch ESMF_XGridMatch proc~esmf_xgridmatch->proc~esmf_xgridgeombasematch proc~esmf_fieldregridstorex ESMF_FieldRegridStoreX proc~esmf_fieldregridstorex->proc~esmf_xgridmatch interface~esmf_fieldregridstore ESMF_FieldRegridStore interface~esmf_fieldregridstore->proc~esmf_fieldregridstorex

Source Code

  function ESMF_GridMatch(grid1, grid2, keywordEnforcer, globalflag, rc)
!
! !RETURN VALUE:
    type(ESMF_GridMatch_Flag) :: ESMF_GridMatch

! !ARGUMENTS:
    type(ESMF_Grid),  intent(in)              :: grid1
    type(ESMF_Grid),  intent(in)              :: grid2
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
    logical,          intent(in),   optional  :: globalflag
    integer,          intent(out),  optional  :: rc
!
!
! !DESCRIPTION:
!  Check if {\tt grid1} and {\tt grid2} match. Returns a range of values of type
!  ESMF\_GridMatch indicating how closely the Grids match. For a description of
!  the possible return values, please see~\ref{const:gridmatch}.
!  Please also note that by default this call is not collective and only
!  returns the match for the piece of the Grids on the local PET. In this case,
!  it is possible for this call to return a different match on different PETs
!  for the same Grids. To do a global match operation set the {\tt globalflag}
!  argument to .true.. In this case, the call becomes collective across the
!  current VM, ensuring the same result is returned on all PETs.
!
!     The arguments are:
!     \begin{description}
!     \item[grid1]
!          {\tt ESMF\_Grid} object.
!     \item[grid2]
!          {\tt ESMF\_Grid} object.
!     \item[{[globalflag]}]
!          By default this flag is set to false. When it's set to true, the
!          function performs the match check globally. In this case,
!          the method becomes collective across the current VM.
!     \item[{[rc]}]
!          Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!     \end{description}
!
!EOP
!------------------------------------------------------------------------------
    integer      :: localrc      ! local return code
    integer      :: matchResult
    integer(ESMF_KIND_I4) :: localResult(1), globalResult(1)
    logical      :: l_global
    integer      :: npet
    type(ESMF_VM) ::  vm

    ! initialize return code; assume routine not implemented
    localrc = ESMF_RC_NOT_IMPL
    if (present(rc)) rc = ESMF_RC_NOT_IMPL

    ! init to one setting in case of error
    ESMF_GridMatch = ESMF_GRIDMATCH_INVALID

    ! Check init status of arguments
    ESMF_INIT_CHECK_DEEP(ESMF_GridGetInit, grid1, rc)
    ESMF_INIT_CHECK_DEEP(ESMF_GridGetInit, grid2, rc)

    ! Call into the C++ interface, which will sort out optional arguments.
    call c_ESMC_GridMatch(grid1, grid2, matchResult, localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    if (matchResult == 1) then
       ESMF_GridMatch = ESMF_GRIDMATCH_EXACT
    else
       ESMF_GridMatch = ESMF_GRIDMATCH_NONE
    endif

    l_global = .false.
    if(present(globalflag)) l_global = globalflag

    if(l_global) then
      call ESMF_VMGetCurrent(vm, rc=localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
      call ESMF_VMGet(vm, petCount=npet, rc=localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return

      localResult(1) = matchResult
      globalResult(1) = 0
      call ESMF_VMAllReduce(vm, localResult, globalResult, &
        1, ESMF_REDUCE_SUM, rc=localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return

      if(globalResult(1) == npet) then
        ESMF_GridMatch = ESMF_GRIDMATCH_EXACT
      else
        ESMF_GridMatch = ESMF_GRIDMATCH_NONE
      endif
    endif

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

  end function ESMF_GridMatch