LegendreQuadrature Subroutine

public subroutine LegendreQuadrature(N, nodes, weights, QuadType)

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: N
real(kind=prec), intent(out) :: nodes(0:N)
real(kind=prec), intent(out) :: weights(0:N)
integer, intent(in) :: QuadType

Contents

Source Code


Source Code

  subroutine LegendreQuadrature(N,nodes,weights,QuadType)
    implicit none
    integer,intent(in)     :: N
    real(prec),intent(out) :: nodes(0:N)
    real(prec),intent(out) :: weights(0:N)
    integer,intent(in)     :: QuadType
    ! Local
    real(real64) :: nodesLocal(0:N)
    real(real64) :: weightsLocal(0:N)
    integer :: i

    if(QuadType == GAUSS_LOBATTO) then

      call LegendreGaussLobatto(N,nodesLocal,weightsLocal)

    elseif(QuadType == GAUSS) then

      call LegendreGauss(N,nodesLocal,weightsLocal)

    endif

    do i = 0,N
      nodes(i) = real(nodesLocal(i),prec)
      weights(i) = real(weightsLocal(i),prec)
    enddo

  endsubroutine LegendreQuadrature