!>
!> @file colpnt.f90
!>
!> @brief
!>
!> @copyright
!> Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
!> SPC (Swiss Plasma Center)
!>
!> SPClibs is free software: you can redistribute it and/or modify it under
!> the terms of the GNU Lesser General Public License as published by the Free
!> Software Foundation, either version 3 of the License, or (at your option)
!> any later version.
!>
!> SPClibs is distributed in the hope that it will be useful, but WITHOUT ANY
!> WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
!> FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
!>
!> You should have received a copy of the GNU Lesser General Public License
!> along with this program. If not, see .
!>
!> @authors
!> (in alphabetical order)
!> @author Trach-Minh Tran
!>
subroutine colpnt ( k, rho )
!*************************************************************************
!
!! COLPNT supplies collocation points.
!
! Discussion:
!
! The collocation points are for the standard interval (-1,1) as the
! zeros of the Legendre polynomial of degree K, provided K <= 8.
!
! Otherwise, uniformly spaced points are given.
!
! Reference:
!
! Carl DeBoor,
! A Practical Guide to Splines,
! Springer Verlag.
!
! Parameters:
!
! Input, integer K, the number of collocation points desired.
!
! Output, real ( kind = 8 ) RHO(K), the collocation points.
!
implicit none
integer k
integer j
real ( kind = 8 ) rho(k)
if ( k == 1 ) then
rho(1) = 0.0D+00
else if ( k == 2 ) then
rho(1) = -0.577350269189626D+00
rho(2) = 0.577350269189626D+00
else if ( k == 3 ) then
rho(1) = -0.774596669241483D+00
rho(2) = 0.0
rho(3) = 0.774596669241483D+00
else if ( k == 4 ) then
rho(1) = -0.861136311594053D+00
rho(2) = -0.339981043584856D+00
rho(3) = 0.339981043584856D+00
rho(4) = 0.861136311594053D+00
else if ( k == 5 ) then
rho(1) = -0.906179845938664D+00
rho(2) = -0.538469310105683D+00
rho(3) = 0.0D+00
rho(4) = 0.538469310105683D+00
rho(5) = 0.906179845938664D+00
else if ( k == 6 ) then
rho(1) = -0.932469514203152D+00
rho(2) = -0.661209386466265D+00
rho(3) = -0.238619186083197D+00
rho(4) = 0.238619186083197D+00
rho(5) = 0.661209386466265D+00
rho(6) = 0.932469514203152D+00
else if ( k == 7 ) then
rho(5) = 0.405845151377397D+00
rho(3) = -rho(5)
rho(6) = 0.741531185599394D+00
rho(2) = -rho(6)
rho(7) = 0.949107912342759D+00
rho(1) = -rho(7)
rho(4) = 0.0
else if ( k == 8 ) then
rho(5) = 0.183434642495650D+00
rho(4) = -rho(5)
rho(6) = 0.525532409916329D+00
rho(3) = -rho(6)
rho(7) = 0.796666477413627D+00
rho(2) = -rho(7)
rho(8) = 0.960289856497536D+00
rho(1) = -rho(8)
else
write ( *, * )' '
write ( *, * )'ColPnt - Warning!'
write ( *, * )' Equispaced collocation points will be used,'
write ( *, * )' because K =',k,' which is greater than 8.'
do j = 1, k
rho(j) = -1.0D+00 + 2.0D+00 * real ( j - 1, kind = 8 ) &
/ real ( k - 1, kind = 8 )
end do
end if
return
end