gjp_quad_gw.f90
Go to the documentation of this file.
1 program gjp_quad_gw
2 
4 use gjp_types, only: dp
5 implicit none
6 
7 integer :: n_points
8 real(dp) :: alpha, beta
9 real(dp), dimension(:), allocatable :: x, w
10 character(len=128) :: arg
11 character(len=:), allocatable :: method
12 integer :: idx
13 
14 if (command_argument_count() /= 3) then
15  print*,"Usage: ./gjp_quad_gw <n_points> <alpha> <beta>"
16  print*," n_points: Number of quadrature points (integer)"
17  print*," alpha: Parameter alpha for Gauss-Jacobi quadrature (must be > -1)"
18  print*," beta: Parameter beta for Gauss-Jacobi quadrature (must be > -1)"
19  error stop "Must supply 3 arguments"
20 end if
21 
22 call get_command_argument(1, arg)
23 read (arg, '(i4)') n_points
24 allocate (x(n_points), w(n_points))
25 
26 call get_command_argument(2, arg)
27 if (index(arg, '.') == 0) then
28  print*,"alpha must include a decimal point"
29  error stop
30 end if
31 read (arg, *) alpha
32 
33 call get_command_argument(3, arg)
34 if (index(arg, '.') == 0) then
35  print*,"beta must include a decimal point"
36  error stop
37 end if
38 read (arg, *) beta
39 
40 method = "gw"
41 call gauss_jacobi(n_points, alpha, beta, x, w, method)
42 
43 do idx = 1, n_points
44  print '(1X, A, 1P, E24.17, 2X, A, 1P, E23.17)', 'Root: ', x(idx), 'Weight: ', w(idx)
45 end do
46 
47 deallocate (x, w)
48 
49 end program gjp_quad_gw
program gjp_quad_gw
Definition: gjp_quad_gw.f90:1
Overall driver for Gauss-Jacobi quadrature.
subroutine gauss_jacobi(npts, alpha, beta, x, wts, method)
Compute the Gauss-Jacobi quadrature nodes and weights.
Module for defining types and precision levels for Gauss-Jacobi Polynomial (GJP) calculations.
Definition: gjp_types.f90:33
integer, parameter, public dp
Define various kinds for real numbers.
Definition: gjp_types.f90:39
Code