utility_compar Subroutine

public subroutine utility_compar(a, b, ifpos, ifneg)

Uses

  • proc~~utility_compar~~UsesGraph proc~utility_compar utility_compar module~w90_constants w90_constants proc~utility_compar->module~w90_constants

Compares two vectors

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(in) :: a(3)
real(kind=dp), intent(in) :: b(3)
integer, intent(out) :: ifpos
integer, intent(out) :: ifneg

Contents

Source Code


Source Code

  subroutine utility_compar(a, b, ifpos, ifneg)
    !==================================================================!
    !                                                                  !
    !! Compares two vectors
    !                                                                  !
    !===================================================================
    use w90_constants, only: eps8

    implicit none

    real(kind=dp), intent(in) :: a(3)
    real(kind=dp), intent(in) :: b(3)
    integer, intent(out) :: ifpos, ifneg

    real(kind=dp) :: rrp, rrm

    rrp = (a(1) - b(1))**2 + (a(2) - b(2))**2 + (a(3) - b(3))**2
    rrm = (a(1) + b(1))**2 + (a(2) + b(2))**2 + (a(3) + b(3))**2
    ifpos = 0
    if (abs(rrp) .lt. eps8) ifpos = 1
    ifneg = 0
    if (abs(rrm) .lt. eps8) ifneg = 1

    return

  end subroutine utility_compar