ESMF_GridEQ Function

private impure elemental function ESMF_GridEQ(grid1, grid2)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Grid), intent(in) :: grid1
type(ESMF_Grid), intent(in) :: grid2

Return Value logical


Source Code

  impure elemental function ESMF_GridEQ(grid1, grid2)
!
! !RETURN VALUE:
    logical :: ESMF_GridEQ

! !ARGUMENTS:
    type(ESMF_Grid), intent(in) :: grid1
    type(ESMF_Grid), intent(in) :: grid2

! !DESCRIPTION:
!   Test if both {\tt grid1} and {\tt grid2} alias the same ESMF Grid
!   object.
!
!EOPI
!-------------------------------------------------------------------------------

    ESMF_INIT_TYPE ginit1, ginit2
    integer :: localrc1, localrc2
    logical :: lval1, lval2

    ! Use the following logic, rather than "ESMF-INIT-CHECK-DEEP", to gain
    ! init checks on both args, and in the case where both are uninitialized,
    ! to distinguish equality based on uninitialized type (uncreated,
    ! deleted).

    ! TODO: Consider moving this logic to C++: use Base class? status?
    !       Or replicate logic for C interface also.

    ! check inputs
    ginit1 = ESMF_GridGetInit(grid1)
    ginit2 = ESMF_GridGetInit(grid2)

    ! TODO: this line must remain split in two for SunOS f90 8.3 127000-03
    if (ginit1 == ESMF_INIT_CREATED .and. &
      ginit2 == ESMF_INIT_CREATED) then
      ESMF_GridEQ = grid1%this == grid2%this
    else
      ESMF_GridEQ = ESMF_FALSE
    endif

  end function ESMF_GridEQ