sym Subroutine

private pure subroutine sym(a, isign, ntgrid)

Forces symmetry in theta in the passed array. If isign == 0 then a(+/- theta) is replaced by the average of a(+/-theta), otherwise a(+/- theta) is replaced by +/- (a(theta)-a(-theta)).

Arguments

Type IntentOptional Attributes Name
real, intent(inout), dimension(-ntgrid:) :: a
integer, intent(in) :: isign
integer, intent(in) :: ntgrid

Contents

Source Code

sym

Source Code

  pure subroutine sym(a, isign, ntgrid)
    implicit none
    integer, intent(in) :: isign, ntgrid
    real, dimension(-ntgrid:), intent (in out) :: a
    integer :: i
    if (isign == 0) then
       do i = 1, ntgrid
          a(i) = 0.5 * (a(i) + a(-i))
          a(-i) = a(i)
       end do
    else
       do i = 1, ntgrid
          a(i) = 0.5 * (a(i) - a(-i))
          a(i) = -a(-i)
       end do
       a(0) = 0.
    end if
  end subroutine sym