ESMF_CplCompEQ Function

private impure elemental function ESMF_CplCompEQ(cplcomp1, cplcomp2)

Arguments

Type IntentOptional Attributes Name
type(ESMF_CplComp), intent(in) :: cplcomp1
type(ESMF_CplComp), intent(in) :: cplcomp2

Return Value logical


Source Code

  impure elemental function ESMF_CplCompEQ(cplcomp1, cplcomp2)
!
! !RETURN VALUE:
    logical :: ESMF_CplCompEQ

! !ARGUMENTS:
    type(ESMF_CplComp), intent(in) :: cplcomp1
    type(ESMF_CplComp), intent(in) :: cplcomp2

! !DESCRIPTION:
!   Test if both {\tt cplcomp1} and {\tt cplcomp2} alias the same ESMF CplComp
!   object.
!
!EOPI
!-------------------------------------------------------------------------------

    ESMF_INIT_TYPE ccinit1, ccinit2
    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
    ccinit1 = ESMF_CplCompGetInit(cplcomp1)
    ccinit2 = ESMF_CplCompGetInit(cplcomp2)

    ! TODO: this line must remain split in two for SunOS f90 8.3 127000-03
    if (ccinit1 .eq. ESMF_INIT_CREATED .and. &
      ccinit2 .eq. ESMF_INIT_CREATED) then
      ESMF_CplCompEQ = associated(cplcomp1%compp,cplcomp2%compp)
    else
      ESMF_CplCompEQ = ESMF_FALSE
    endif

  end function ESMF_CplCompEQ