23 use,
intrinsic :: iso_fortran_env
33 real(real64),
target :: GL_points_2(1) = (/ &
34 -0.57735026919_real64 /)
35 real(real64),
target :: GL_weights_2(1) = (/ &
39 real(real64),
target :: GL_points_3(2) = (/ &
40 -0.774596669241_real64,
m_zero /)
41 real(real64),
target :: GL_weights_3(2) = (/ &
42 0.555555555556_real64, 0.888888888889_real64 /)
45 real(real64),
target :: GL_points_4(2) = (/ &
46 -0.861136311594_real64, -0.339981043585_real64 /)
47 real(real64),
target :: GL_weights_4(2) = (/ &
48 0.347854845137_real64, 0.652145154863_real64 /)
51 real(real64),
target :: GL_points_5(3) = (/ &
52 -0.906179845939_real64, -0.538469310106_real64,
m_zero /)
53 real(real64),
target :: GL_weights_5(3) = (/ &
54 0.236926885056_real64, 0.478628670499_real64, 0.568888888889_real64 /)
57 real(real64),
target :: GL_points_6(3) = (/ &
58 -0.932469514203_real64, -0.661209386466_real64, -0.238619186083_real64 /)
59 real(real64),
target :: GL_weights_6(3) = (/ &
60 0.171324492379_real64, 0.360761573048_real64, 0.467913934573_real64 /)
63 real(real64),
target :: GL_points_7(4) = (/ &
64 -0.949107912343_real64, -0.741531185599_real64, -0.405845151377_real64, &
66 real(real64),
target :: GL_weights_7(4) = (/ &
67 0.129484966169_real64, 0.279705391489_real64, 0.381830050505_real64, &
68 0.417959183673_real64 /)
71 real(real64),
target :: GL_points_8(4) = (/ &
72 -0.960289856498_real64, -0.796666477414_real64, -0.525532409916_real64, &
73 -0.183434642496_real64 /)
74 real(real64),
target :: GL_weights_8(4) = (/ &
75 0.10122853629_real64, 0.222381034453_real64, 0.313706645878_real64, &
76 0.362683783378_real64 /)
79 real(real64),
target :: GL_points_9(5) = (/ &
80 -0.968160239508_real64, -0.836031107327_real64, -0.613371432701_real64, &
81 -0.324253423404_real64,
m_zero /)
82 real(real64),
target :: GL_weights_9(5) = (/ &
83 0.0812743883616_real64, 0.180648160695_real64, 0.260610696403_real64, &
84 0.31234707704_real64, 0.330239355001_real64 /)
87 real(real64),
target :: GL_points_10(5) = (/ &
88 -0.973906528517_real64, -0.865063366689_real64, -0.679409568299_real64, &
89 -0.433395394129_real64, -0.148874338982_real64 /)
90 real(real64),
target :: GL_weights_10(5) = (/ &
91 0.0666713443087_real64, 0.149451349151_real64, 0.219086362516_real64, &
92 0.26926671931_real64, 0.295524224715_real64 /)
95 real(real64),
target :: GL_points_11(6) = (/ &
96 -0.978228658146_real64, -0.887062599768_real64, -0.730152005574_real64, &
97 -0.519096129207_real64, -0.269543155952_real64,
m_zero /)
98 real(real64),
target :: GL_weights_11(6) = (/ &
99 0.0556685671162_real64, 0.125580369465_real64, 0.186290210928_real64, &
100 0.233193764592_real64, 0.26280454451_real64, 0.272925086778_real64 /)
103 real(real64),
target :: GL_points_12(6) = (/ &
104 -0.981560634247_real64, -0.90411725637_real64, -0.769902674194_real64, &
105 -0.587317954287_real64, -0.367831498998_real64, -0.125233408511_real64 /)
106 real(real64),
target :: GL_weights_12(6) = (/ &
107 0.0471753363866_real64, 0.106939325995_real64, 0.160078328543_real64, &
108 0.203167426723_real64, 0.233492536538_real64, 0.249147045813_real64 /)
114 integer,
intent(in) :: n
115 real(real64),
intent(out) :: points(:)
116 real(real64),
intent(out) :: weights(:)
120 real(real64),
pointer :: points_ref(:), weights_ref(:)
125 assert(n >= 2.and.n <= 12)
128 points_ref => gl_points_2
129 weights_ref => gl_weights_2
131 points_ref => gl_points_3
132 weights_ref => gl_weights_3
134 points_ref => gl_points_4
135 weights_ref => gl_weights_4
137 points_ref => gl_points_5
138 weights_ref => gl_weights_5
140 points_ref => gl_points_6
141 weights_ref => gl_weights_6
143 points_ref => gl_points_7
144 weights_ref => gl_weights_7
146 points_ref => gl_points_8
147 weights_ref => gl_weights_8
149 points_ref => gl_points_9
150 weights_ref => gl_weights_9
152 points_ref => gl_points_10
153 weights_ref => gl_weights_10
155 points_ref => gl_points_11
156 weights_ref => gl_weights_11
158 points_ref => gl_points_12
159 weights_ref => gl_weights_12
163 points(i) = points_ref(i)
164 points(n-i+1) = -points_ref(i)
165 weights(i) = weights_ref(i)
166 weights(n-i+1) = weights_ref(i)
168 if (mod(n, 2) == 1)
then
169 points(n/2 + 1) = points_ref(n/2 + 1)
170 weights(n/2 + 1) = weights_ref(n/2 + 1)
subroutine, public gauss_legendre_points(n, points, weights)
real(real64), parameter, public m_zero
real(real64), parameter, public m_one