ESMF_GridCompEQ Function

private impure elemental function ESMF_GridCompEQ(gridcomp1, gridcomp2)

Arguments

Type IntentOptional Attributes Name
type(ESMF_GridComp), intent(in) :: gridcomp1
type(ESMF_GridComp), intent(in) :: gridcomp2

Return Value logical


Source Code

  impure elemental function ESMF_GridCompEQ(gridcomp1, gridcomp2)
!
! !RETURN VALUE:
    logical :: ESMF_GridCompEQ

! !ARGUMENTS:
    type(ESMF_GridComp), intent(in) :: gridcomp1
    type(ESMF_GridComp), intent(in) :: gridcomp2

!
! !DESCRIPTION:
!   Test if both {\tt gridcomp1} and {\tt gridcomp2} alias the same ESMF GridComp
!   object.
!
!EOPI
!-------------------------------------------------------------------------------

    ESMF_INIT_TYPE gcinit1, gcinit2
    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
    gcinit1 = ESMF_GridCompGetInit(gridcomp1)
    gcinit2 = ESMF_GridCompGetInit(gridcomp2)

    ! TODO: this line must remain split in two for SunOS f90 8.3 127000-03
    if (gcinit1 .eq. ESMF_INIT_CREATED .and. &
      gcinit2 .eq. ESMF_INIT_CREATED) then
      ESMF_GridCompEQ = associated(gridcomp1%compp,gridcomp2%compp)
    else
      ESMF_GridCompEQ = ESMF_FALSE
    endif

  end function ESMF_GridCompEQ