ESMF_LocStreamEQ Function

private impure elemental function ESMF_LocStreamEQ(locstream1, locstream2)

Arguments

Type IntentOptional Attributes Name
type(ESMF_LocStream), intent(in) :: locstream1
type(ESMF_LocStream), intent(in) :: locstream2

Return Value logical


Source Code

  impure elemental function ESMF_LocStreamEQ(locstream1, locstream2)
! 
! !RETURN VALUE:
    logical :: ESMF_LocStreamEQ

! !ARGUMENTS:
    type(ESMF_LocStream), intent(in) :: locstream1
    type(ESMF_LocStream), intent(in) :: locstream2

! !DESCRIPTION:
!   Test if both {\tt locstream1} and {\tt locstream2} alias the same ESMF LocStream 
!   object.
!
!EOPI
!-------------------------------------------------------------------------------

    ESMF_INIT_TYPE lsinit1, lsinit2
    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
    lsinit1 = ESMF_LocStreamGetInit(locstream1)
    lsinit2 = ESMF_LocStreamGetInit(locstream2)

    ! TODO: this line must remain split in two for SunOS f90 8.3 127000-03
    if (lsinit1 .eq. ESMF_INIT_CREATED .and. &
      lsinit2 .eq. ESMF_INIT_CREATED) then
      ESMF_LocStreamEQ = associated(locstream1%lstypep,locstream2%lstypep)
    else
      ESMF_LocStreamEQ = ESMF_FALSE
    endif

  end function ESMF_LocStreamEQ