ESMF_ClockNE Function

private impure elemental function ESMF_ClockNE(clock1, clock2)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Clock), intent(in) :: clock1
type(ESMF_Clock), intent(in) :: clock2

Return Value logical


Source Code

      impure elemental function ESMF_ClockNE(clock1, clock2)
!
! !RETURN VALUE:
      logical :: ESMF_ClockNE

! !ARGUMENTS:
      type(ESMF_Clock), intent(in) :: clock1
      type(ESMF_Clock), intent(in) :: clock2

! !DESCRIPTION:
!     This method overloads the (/=) operator for the {\tt ESMF\_Clock}
!     class.  See "interface operator(/=)" above for complete description.
!
!EOPI
      ESMF_INIT_TYPE clockinit1, clockinit2
      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
      clockinit1 = ESMF_ClockGetInit(clock1)
      clockinit2 = ESMF_ClockGetInit(clock2)

      if (clockinit1.eq.ESMF_INIT_CREATED.and. &
          clockinit2.eq.ESMF_INIT_CREATED) then
        ! invoke C to C++ entry point
        call c_ESMC_ClockNE(clock1, clock2, ESMF_ClockNE)
      else
        ! log error, convert to return code, and compare
        lval1 = ESMF_IMErr(clockinit1, ESMF_CONTEXT, rc=localrc1)
        lval2 = ESMF_IMErr(clockinit2, ESMF_CONTEXT, rc=localrc2)
        ESMF_ClockNE = localrc1.ne.localrc2
      endif

      end function ESMF_ClockNE