PyFishPack 0.1.0__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- PyFishPack/__init__.py +86 -0
- PyFishPack/__pycache__/__init__.cpython-313.pyc +0 -0
- PyFishPack/__pycache__/apps.cpython-313.pyc +0 -0
- PyFishPack/_dummy.c +23 -0
- PyFishPack/_dummy.cp313-win_amd64.pyd +0 -0
- PyFishPack/apps.py +3640 -0
- PyFishPack/fishpack.cp313-win_amd64.dll.a +0 -0
- PyFishPack/fishpack.cp313-win_amd64.pyd +0 -0
- PyFishPack/meson.build +213 -0
- PyFishPack/src/archive/f77/Makefile +19 -0
- PyFishPack/src/archive/f77/blktri.f +1404 -0
- PyFishPack/src/archive/f77/cblktri.f +1414 -0
- PyFishPack/src/archive/f77/cmgnbn.f +1592 -0
- PyFishPack/src/archive/f77/comf.f +186 -0
- PyFishPack/src/archive/f77/fftpack.f +2968 -0
- PyFishPack/src/archive/f77/genbun.f +1335 -0
- PyFishPack/src/archive/f77/gnbnaux.f +314 -0
- PyFishPack/src/archive/f77/hstcrt.f +443 -0
- PyFishPack/src/archive/f77/hstcsp.f +683 -0
- PyFishPack/src/archive/f77/hstcyl.f +485 -0
- PyFishPack/src/archive/f77/hstplr.f +538 -0
- PyFishPack/src/archive/f77/hstssp.f +634 -0
- PyFishPack/src/archive/f77/hw3crt.f +687 -0
- PyFishPack/src/archive/f77/hwscrt.f +512 -0
- PyFishPack/src/archive/f77/hwscsp.f +728 -0
- PyFishPack/src/archive/f77/hwscyl.f +538 -0
- PyFishPack/src/archive/f77/hwsplr.f +602 -0
- PyFishPack/src/archive/f77/hwsssp.f +780 -0
- PyFishPack/src/archive/f77/pois3d.f +550 -0
- PyFishPack/src/archive/f77/poistg.f +875 -0
- PyFishPack/src/archive/f77/sepaux.f +361 -0
- PyFishPack/src/archive/f77/sepeli.f +1029 -0
- PyFishPack/src/archive/f77/sepx4.f +958 -0
- PyFishPack/src/centered_axisymmetric_spherical_solver.f90 +1002 -0
- PyFishPack/src/centered_cartesian_helmholtz_solver_3d.f90 +819 -0
- PyFishPack/src/centered_cartesian_solver.f90 +583 -0
- PyFishPack/src/centered_cylindrical_solver.f90 +634 -0
- PyFishPack/src/centered_helmholtz_solvers.f90 +156 -0
- PyFishPack/src/centered_polar_solver.f90 +746 -0
- PyFishPack/src/centered_real_linear_systems_solver.f90 +280 -0
- PyFishPack/src/centered_spherical_solver.f90 +928 -0
- PyFishPack/src/complex_block_tridiagonal_linear_systems_solver.f90 +1947 -0
- PyFishPack/src/complex_linear_systems_solver.f90 +1787 -0
- PyFishPack/src/fftpack_c_api.f90 +86 -0
- PyFishPack/src/fishpack.f90 +191 -0
- PyFishPack/src/fishpack.pyf +504 -0
- PyFishPack/src/fishpack_c_api.f90 +365 -0
- PyFishPack/src/fishpack_original.pyf +2119 -0
- PyFishPack/src/fishpack_precision.f90 +53 -0
- PyFishPack/src/general_linear_systems_solver_3d.f90 +296 -0
- PyFishPack/src/iterative_solvers.f90 +969 -0
- PyFishPack/src/main.f90 +10 -0
- PyFishPack/src/pyfishpack_module.c +1302 -0
- PyFishPack/src/real_block_tridiagonal_linear_systems_solver.f90 +319 -0
- PyFishPack/src/sepeli.f90 +1454 -0
- PyFishPack/src/sepx4.f90 +1338 -0
- PyFishPack/src/staggered_axisymmetric_spherical_solver.f90 +908 -0
- PyFishPack/src/staggered_cartesian_solver.f90 +553 -0
- PyFishPack/src/staggered_cylindrical_solver.f90 +630 -0
- PyFishPack/src/staggered_helmholtz_solvers.f90 +172 -0
- PyFishPack/src/staggered_polar_solver.f90 +651 -0
- PyFishPack/src/staggered_real_linear_systems_solver.f90 +258 -0
- PyFishPack/src/staggered_spherical_solver.f90 +758 -0
- PyFishPack/src/three_dimensional_solvers.f90 +602 -0
- PyFishPack/src/type_CenteredCyclicReductionUtility.f90 +1714 -0
- PyFishPack/src/type_CyclicReductionUtility.f90 +472 -0
- PyFishPack/src/type_FishpackWorkspace.f90 +290 -0
- PyFishPack/src/type_GeneralizedCyclicReductionUtility.f90 +1980 -0
- PyFishPack/src/type_PeriodicFastFourierTransform.f90 +3789 -0
- PyFishPack/src/type_SepAux.f90 +586 -0
- PyFishPack/src/type_StaggeredCyclicReductionUtility.f90 +893 -0
- pyfishpack-0.1.0.dist-info/DELVEWHEEL +2 -0
- pyfishpack-0.1.0.dist-info/METADATA +81 -0
- pyfishpack-0.1.0.dist-info/RECORD +81 -0
- pyfishpack-0.1.0.dist-info/WHEEL +5 -0
- pyfishpack-0.1.0.dist-info/licenses/LICENSE +21 -0
- pyfishpack-0.1.0.dist-info/top_level.txt +1 -0
- pyfishpack.libs/libgcc_s_seh-1-25d59ccffa1a9009644065b069829e07.dll +0 -0
- pyfishpack.libs/libgfortran-5-08f2195cfa0d823e13371c5c3186a82a.dll +0 -0
- pyfishpack.libs/libquadmath-0-c5abb9113f1ee64b87a889958e4b7418.dll +0 -0
- pyfishpack.libs/libwinpthread-1-83908d14abfafb8b3bfa38cf51ecee56.dll +0 -0
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
!
|
|
2
|
+
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
3
|
+
! * *
|
|
4
|
+
! * copyright (c) 2005 by UCAR *
|
|
5
|
+
! * *
|
|
6
|
+
! * University Corporation for Atmospheric Research *
|
|
7
|
+
! * *
|
|
8
|
+
! * all rights reserved *
|
|
9
|
+
! * *
|
|
10
|
+
! * Fishpack *
|
|
11
|
+
! * *
|
|
12
|
+
! * A Package of Fortran *
|
|
13
|
+
! * *
|
|
14
|
+
! * Subroutines and Example Programs *
|
|
15
|
+
! * *
|
|
16
|
+
! * for Modeling Geophysical Processes *
|
|
17
|
+
! * *
|
|
18
|
+
! * by *
|
|
19
|
+
! * *
|
|
20
|
+
! * John Adams, Paul Swarztrauber and Roland Sweet *
|
|
21
|
+
! * *
|
|
22
|
+
! * of *
|
|
23
|
+
! * *
|
|
24
|
+
! * the National Center for Atmospheric Research *
|
|
25
|
+
! * *
|
|
26
|
+
! * Boulder, Colorado (80307) U.S.A. *
|
|
27
|
+
! * *
|
|
28
|
+
! * which is sponsored by *
|
|
29
|
+
! * *
|
|
30
|
+
! * the National Science Foundation *
|
|
31
|
+
! * *
|
|
32
|
+
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
33
|
+
!
|
|
34
|
+
! Purpose to provide auxiliary routines for fishpack
|
|
35
|
+
! entries genbun and poistg.
|
|
36
|
+
!
|
|
37
|
+
! Usage There are no user entries in this package.
|
|
38
|
+
! the routines in this package are not intended
|
|
39
|
+
! to be called by users, but rather by routines
|
|
40
|
+
! in genbun and poistg.
|
|
41
|
+
!
|
|
42
|
+
! History * Written in 1979 by Roland Sweet of NCAR'S
|
|
43
|
+
! scientific computing division. Made available
|
|
44
|
+
! on NCAR's public libraries in January, 1980.
|
|
45
|
+
! * Revised by John Adams in June 2004 incorporating
|
|
46
|
+
! Fortran 90 features
|
|
47
|
+
!
|
|
48
|
+
module type_CyclicReductionUtility
|
|
49
|
+
|
|
50
|
+
use fishpack_precision, only: &
|
|
51
|
+
wp, & ! Working precision
|
|
52
|
+
ip, & ! Integer precision
|
|
53
|
+
PI
|
|
54
|
+
|
|
55
|
+
! Explicit typing only
|
|
56
|
+
implicit none
|
|
57
|
+
|
|
58
|
+
! Everything is private unless stated otherwise
|
|
59
|
+
private
|
|
60
|
+
public :: CyclicReductionUtility
|
|
61
|
+
|
|
62
|
+
type, public :: CyclicReductionUtility
|
|
63
|
+
contains
|
|
64
|
+
! Public type-bound procedures
|
|
65
|
+
procedure, nopass, public :: generate_cosines
|
|
66
|
+
procedure, nopass, public :: merge_cosines
|
|
67
|
+
procedure, nopass, public :: solve_tridiag
|
|
68
|
+
procedure, nopass, public :: solve_tridiag3
|
|
69
|
+
! Private type-bound procedures
|
|
70
|
+
procedure, nopass, private :: swap_real
|
|
71
|
+
procedure, nopass, private :: swap_complex
|
|
72
|
+
procedure, nopass, private :: swap_integer
|
|
73
|
+
procedure, nopass, private :: swap_character
|
|
74
|
+
! Generic type-bound procedures
|
|
75
|
+
generic, public :: swap => swap_real, &
|
|
76
|
+
swap_complex, &
|
|
77
|
+
swap_integer, &
|
|
78
|
+
swap_character
|
|
79
|
+
end type CyclicReductionUtility
|
|
80
|
+
|
|
81
|
+
! Parameters confined to the module
|
|
82
|
+
real(wp), parameter :: ZERO = 0.0_wp
|
|
83
|
+
real(wp), parameter :: TWO = 2.0_wp
|
|
84
|
+
|
|
85
|
+
contains
|
|
86
|
+
|
|
87
|
+
!
|
|
88
|
+
! Purpose:
|
|
89
|
+
!
|
|
90
|
+
! this subroutine computes required cosine values in ascending
|
|
91
|
+
! order. when ijump >= 1 the routine computes values
|
|
92
|
+
!
|
|
93
|
+
! 2*cos(j*pi/l) , j=1, 2, ..., l and j /= 0(mod n/ijump+1)
|
|
94
|
+
!
|
|
95
|
+
! where l = ijump*(n/ijump+1).
|
|
96
|
+
!
|
|
97
|
+
!
|
|
98
|
+
! when ijump = 1 it computes
|
|
99
|
+
!
|
|
100
|
+
! 2*cos((j-fnum)*pi/(n+fden)) , j=1, 2, ... , n
|
|
101
|
+
!
|
|
102
|
+
! where
|
|
103
|
+
! fnum = 0.5, fden = 0.0, for regular reduction values
|
|
104
|
+
! fnum = 0.0, fden = 1.0, for b-r and c-r when istag = 1
|
|
105
|
+
! fnum = 0.0, fden = 0.5, for b-r and c-r when istag = 2
|
|
106
|
+
! fnum = 0.5, fden = 0.5, for b-r and c-r when istag = 2
|
|
107
|
+
! in poisn2 only.
|
|
108
|
+
!
|
|
109
|
+
pure subroutine generate_cosines(n, ijump, fnum, fden, a)
|
|
110
|
+
|
|
111
|
+
! Dummy arguments
|
|
112
|
+
integer(ip), intent(in) :: n
|
|
113
|
+
integer(ip), intent(in) :: ijump
|
|
114
|
+
real(wp), intent(in) :: fnum
|
|
115
|
+
real(wp), intent(in) :: fden
|
|
116
|
+
real(wp), intent(out) :: a(:)
|
|
117
|
+
|
|
118
|
+
! Local variables
|
|
119
|
+
integer(ip) :: k3, k4, k, k1, k5, i, k2, np1
|
|
120
|
+
real(wp) :: pibyn, x, y
|
|
121
|
+
|
|
122
|
+
if (n == 0) return
|
|
123
|
+
|
|
124
|
+
select case (ijump)
|
|
125
|
+
case (1)
|
|
126
|
+
!
|
|
127
|
+
! ijump == 1
|
|
128
|
+
!
|
|
129
|
+
np1 = n + 1
|
|
130
|
+
y = PI/(real(n, kind=wp) + fden)
|
|
131
|
+
|
|
132
|
+
do i = 1, n
|
|
133
|
+
x = real(np1 - i, kind=wp) - fnum
|
|
134
|
+
a(i) = TWO * cos(x*y)
|
|
135
|
+
end do
|
|
136
|
+
|
|
137
|
+
case default
|
|
138
|
+
!
|
|
139
|
+
! ijump /= 1
|
|
140
|
+
!
|
|
141
|
+
k3 = n/ijump + 1
|
|
142
|
+
k4 = k3 - 1
|
|
143
|
+
pibyn = PI/(n + ijump)
|
|
144
|
+
do k = 1, ijump
|
|
145
|
+
k1 = (k - 1)*k3
|
|
146
|
+
k5 = (k - 1)*k4
|
|
147
|
+
do i = 1, k4
|
|
148
|
+
x = k1 + i
|
|
149
|
+
k2 = k5 + i
|
|
150
|
+
a(k2) = -TWO * cos(x*pibyn)
|
|
151
|
+
end do
|
|
152
|
+
end do
|
|
153
|
+
end select
|
|
154
|
+
|
|
155
|
+
end subroutine generate_cosines
|
|
156
|
+
|
|
157
|
+
!
|
|
158
|
+
! Purpose:
|
|
159
|
+
!
|
|
160
|
+
! subroutine to solve a system of linear equations where the
|
|
161
|
+
! coefficient matrix is a rational function in the matrix given by
|
|
162
|
+
! tridiagonal ( . . . , a(i), b(i), c(i), . . . ).
|
|
163
|
+
!
|
|
164
|
+
subroutine solve_tridiag(idegbr, idegcr, m, a, b, c, y, tcos, d, w)
|
|
165
|
+
|
|
166
|
+
! Dummy arguments
|
|
167
|
+
integer(ip), intent(in) :: idegbr
|
|
168
|
+
integer(ip), intent(in) :: idegcr
|
|
169
|
+
integer(ip), intent(in) :: m
|
|
170
|
+
real(wp), intent(in) :: a(:)
|
|
171
|
+
real(wp), intent(in) :: b(:)
|
|
172
|
+
real(wp), intent(in) :: c(:)
|
|
173
|
+
real(wp), intent(inout) :: y(:)
|
|
174
|
+
real(wp), intent(in) :: tcos(:)
|
|
175
|
+
real(wp), intent(inout) :: d(:)
|
|
176
|
+
real(wp), intent(inout) :: w(:)
|
|
177
|
+
|
|
178
|
+
! Local variables
|
|
179
|
+
integer(ip) :: ifb, ifc, j, lint, k, i
|
|
180
|
+
real(wp) :: x, xx, temp
|
|
181
|
+
|
|
182
|
+
ifb = idegbr + 1
|
|
183
|
+
ifc = idegcr + 1
|
|
184
|
+
j = ifb/ifc
|
|
185
|
+
lint = 1
|
|
186
|
+
|
|
187
|
+
outer_loop: do k = 1, idegbr
|
|
188
|
+
|
|
189
|
+
x = tcos(k)
|
|
190
|
+
|
|
191
|
+
if (k == j) then
|
|
192
|
+
i = idegbr + lint
|
|
193
|
+
xx = x - tcos(i)
|
|
194
|
+
w(:m) = y(:m)
|
|
195
|
+
y(:m) = xx*y(:m)
|
|
196
|
+
end if
|
|
197
|
+
|
|
198
|
+
temp = b(1) - x
|
|
199
|
+
d(1) = c(1)/temp
|
|
200
|
+
y(1) = y(1)/temp
|
|
201
|
+
|
|
202
|
+
do i = 2, m - 1
|
|
203
|
+
temp = b(i) - x - a(i) * d(i-1)
|
|
204
|
+
d(i) = c(i)/temp
|
|
205
|
+
y(i) = (y(i) - a(i) * y(i-1))/temp
|
|
206
|
+
end do
|
|
207
|
+
|
|
208
|
+
temp = b(m) - x - a(m) * d(m - 1)
|
|
209
|
+
|
|
210
|
+
if (temp == ZERO) then
|
|
211
|
+
y(m) = ZERO
|
|
212
|
+
else
|
|
213
|
+
y(m) = (y(m) - a(m) * y(m - 1))/temp
|
|
214
|
+
end if
|
|
215
|
+
|
|
216
|
+
do i = m - 1, 1, -1
|
|
217
|
+
y(i) = y(i) - d(i) * y(i + 1)
|
|
218
|
+
end do
|
|
219
|
+
|
|
220
|
+
if (k /= j) cycle outer_loop
|
|
221
|
+
|
|
222
|
+
y(:m) = y(:m) + w(:m)
|
|
223
|
+
lint = lint + 1
|
|
224
|
+
j = (lint*ifb)/ifc
|
|
225
|
+
|
|
226
|
+
end do outer_loop
|
|
227
|
+
|
|
228
|
+
end subroutine solve_tridiag
|
|
229
|
+
|
|
230
|
+
!
|
|
231
|
+
! Purpose:
|
|
232
|
+
!
|
|
233
|
+
! subroutine to solve three linear systems whose common coefficient
|
|
234
|
+
! matrix is a rational function in the matrix given by
|
|
235
|
+
!
|
|
236
|
+
! tridiagonal (..., a(i), b(i), c(i), ...)
|
|
237
|
+
!
|
|
238
|
+
subroutine solve_tridiag3(m, a, b, c, k, y1, y2, y3, tcos, d, w1, w2, w3)
|
|
239
|
+
|
|
240
|
+
! Dummy arguments
|
|
241
|
+
integer(ip), intent(in) :: m
|
|
242
|
+
integer(ip), intent(in) :: k(4)
|
|
243
|
+
real(wp), intent(in) :: a(:)
|
|
244
|
+
real(wp), intent(in) :: b(:)
|
|
245
|
+
real(wp), intent(in) :: c(:)
|
|
246
|
+
real(wp), intent(inout) :: y1(:)
|
|
247
|
+
real(wp), intent(inout) :: y2(:)
|
|
248
|
+
real(wp), intent(inout) :: y3(:)
|
|
249
|
+
real(wp), intent(in) :: tcos(:)
|
|
250
|
+
real(wp), intent(inout) :: d(:)
|
|
251
|
+
real(wp), intent(inout) :: w1(:)
|
|
252
|
+
real(wp), intent(inout) :: w2(:)
|
|
253
|
+
real(wp), intent(inout) :: w3(:)
|
|
254
|
+
|
|
255
|
+
! Local variables
|
|
256
|
+
integer(ip) :: mm1, k1, k2, k3, k4, if1, if2, if3, if4, k2k3k4, l1, l2
|
|
257
|
+
integer(ip) :: l3, lint1, lint2, lint3, kint1, kint2, kint3, n, i
|
|
258
|
+
real(wp) :: x, temp, xx
|
|
259
|
+
|
|
260
|
+
mm1 = m - 1
|
|
261
|
+
k1 = k(1)
|
|
262
|
+
k2 = k(2)
|
|
263
|
+
k3 = k(3)
|
|
264
|
+
k4 = k(4)
|
|
265
|
+
if1 = k1 + 1
|
|
266
|
+
if2 = k2 + 1
|
|
267
|
+
if3 = k3 + 1
|
|
268
|
+
if4 = k4 + 1
|
|
269
|
+
k2k3k4 = k2 + k3 + k4
|
|
270
|
+
|
|
271
|
+
if (k2k3k4 /= 0) then
|
|
272
|
+
l1 = if1/if2
|
|
273
|
+
l2 = if1/if3
|
|
274
|
+
l3 = if1/if4
|
|
275
|
+
lint1 = 1
|
|
276
|
+
lint2 = 1
|
|
277
|
+
lint3 = 1
|
|
278
|
+
kint1 = k1
|
|
279
|
+
kint2 = kint1 + k2
|
|
280
|
+
kint3 = kint2 + k3
|
|
281
|
+
end if
|
|
282
|
+
|
|
283
|
+
outer_loop: do n = 1, k1
|
|
284
|
+
|
|
285
|
+
x = tcos(n)
|
|
286
|
+
|
|
287
|
+
if (k2k3k4 /= 0) then
|
|
288
|
+
if (n == l1) w1(:m) = y1(:m)
|
|
289
|
+
if (n == l2) w2(:m) = y2(:m)
|
|
290
|
+
if (n == l3) w3(:m) = y3(:m)
|
|
291
|
+
end if
|
|
292
|
+
|
|
293
|
+
temp = b(1) - x
|
|
294
|
+
d(1) = c(1)/temp
|
|
295
|
+
y1(1) = y1(1)/temp
|
|
296
|
+
y2(1) = y2(1)/temp
|
|
297
|
+
y3(1) = y3(1)/temp
|
|
298
|
+
|
|
299
|
+
do i = 2, m
|
|
300
|
+
temp = b(i)-x-a(i)*d(i-1)
|
|
301
|
+
d(i) = c(i)/temp
|
|
302
|
+
y1(i) = (y1(i)-a(i)*y1(i-1))/temp
|
|
303
|
+
y2(i) = (y2(i)-a(i)*y2(i-1))/temp
|
|
304
|
+
y3(i) = (y3(i)-a(i)*y3(i-1))/temp
|
|
305
|
+
end do
|
|
306
|
+
|
|
307
|
+
do i = m - 1, 1, -1
|
|
308
|
+
y1(i) = y1(i) - d(i) * y1(i + 1)
|
|
309
|
+
y2(i) = y2(i) - d(i) * y2(i + 1)
|
|
310
|
+
y3(i) = y3(i) - d(i) * y3(i + 1)
|
|
311
|
+
end do
|
|
312
|
+
|
|
313
|
+
if (k2k3k4 == 0) cycle outer_loop
|
|
314
|
+
|
|
315
|
+
if (n == l1) then
|
|
316
|
+
i = lint1 + kint1
|
|
317
|
+
xx = x - tcos(i)
|
|
318
|
+
y1(:m) = xx*y1(:m) + w1(:m)
|
|
319
|
+
lint1 = lint1 + 1
|
|
320
|
+
l1 = (lint1*if1)/if2
|
|
321
|
+
end if
|
|
322
|
+
|
|
323
|
+
if (n == l2) then
|
|
324
|
+
i = lint2 + kint2
|
|
325
|
+
xx = x - tcos(i)
|
|
326
|
+
y2(:m) = xx*y2(:m) + w2(:m)
|
|
327
|
+
lint2 = lint2 + 1
|
|
328
|
+
l2 = (lint2*if1)/if3
|
|
329
|
+
end if
|
|
330
|
+
|
|
331
|
+
if (n /= l3) cycle outer_loop
|
|
332
|
+
|
|
333
|
+
i = lint3 + kint3
|
|
334
|
+
xx = x - tcos(i)
|
|
335
|
+
y3(:m) = xx*y3(:m) + w3(:m)
|
|
336
|
+
lint3 = lint3 + 1
|
|
337
|
+
l3 = (lint3*if1)/if4
|
|
338
|
+
|
|
339
|
+
end do outer_loop
|
|
340
|
+
|
|
341
|
+
end subroutine solve_tridiag3
|
|
342
|
+
|
|
343
|
+
! Purpose:
|
|
344
|
+
!
|
|
345
|
+
! this subroutine merges two ascending strings of numbers in the
|
|
346
|
+
! array tcos. the first string is of length m1 and starts at
|
|
347
|
+
! tcos(i1+1). the second string is of length m2 and starts at
|
|
348
|
+
! tcos(i2+1). the merged string goes into tcos(i3+1).
|
|
349
|
+
!
|
|
350
|
+
subroutine merge_cosines(tcos, i1, m1, i2, m2, i3)
|
|
351
|
+
|
|
352
|
+
! Dummy arguments
|
|
353
|
+
integer(ip), intent(in) :: i1
|
|
354
|
+
integer(ip), intent(in) :: m1
|
|
355
|
+
integer(ip), intent(in) :: i2
|
|
356
|
+
integer(ip), intent(in) :: m2
|
|
357
|
+
integer(ip), intent(in) :: i3
|
|
358
|
+
real(wp), intent(inout) :: tcos(:)
|
|
359
|
+
|
|
360
|
+
! Local variables
|
|
361
|
+
integer(ip) :: j, j1, j2, k, l, m
|
|
362
|
+
|
|
363
|
+
j1 = 1
|
|
364
|
+
j2 = 1
|
|
365
|
+
j = i3
|
|
366
|
+
|
|
367
|
+
if (m1 == 0) then
|
|
368
|
+
if (m2 == 0) return
|
|
369
|
+
k = j - j2 + 1
|
|
370
|
+
do j = j2, m2
|
|
371
|
+
m = k + j
|
|
372
|
+
l = j + i2
|
|
373
|
+
tcos(m) = tcos(l)
|
|
374
|
+
end do
|
|
375
|
+
return
|
|
376
|
+
end if
|
|
377
|
+
|
|
378
|
+
if (m2 == 0) then
|
|
379
|
+
k = j - j1 + 1
|
|
380
|
+
do j = j1, m1
|
|
381
|
+
m = k + j
|
|
382
|
+
l = j + i1
|
|
383
|
+
tcos(m) = tcos(l)
|
|
384
|
+
end do
|
|
385
|
+
return
|
|
386
|
+
end if
|
|
387
|
+
|
|
388
|
+
do
|
|
389
|
+
j = j + 1
|
|
390
|
+
if (tcos(i1+j1) <= tcos(i2+j2)) then
|
|
391
|
+
tcos(j) = tcos(i1+j1)
|
|
392
|
+
j1 = j1 + 1
|
|
393
|
+
if (j1 > m1) exit
|
|
394
|
+
else
|
|
395
|
+
tcos(j) = tcos(i2+j2)
|
|
396
|
+
j2 = j2 + 1
|
|
397
|
+
if (j2 > m2) then
|
|
398
|
+
if (j1 > m1) return
|
|
399
|
+
exit
|
|
400
|
+
end if
|
|
401
|
+
end if
|
|
402
|
+
end do
|
|
403
|
+
|
|
404
|
+
if (j1 <= m1) then
|
|
405
|
+
k = j - j1 + 1
|
|
406
|
+
do j = j1, m1
|
|
407
|
+
m = k + j
|
|
408
|
+
l = j + i1
|
|
409
|
+
tcos(m) = tcos(l)
|
|
410
|
+
end do
|
|
411
|
+
else if (j2 <= m2) then
|
|
412
|
+
k = j - j2 + 1
|
|
413
|
+
do j = j2, m2
|
|
414
|
+
m = k + j
|
|
415
|
+
l = j + i2
|
|
416
|
+
tcos(m) = tcos(l)
|
|
417
|
+
end do
|
|
418
|
+
end if
|
|
419
|
+
|
|
420
|
+
end subroutine merge_cosines
|
|
421
|
+
|
|
422
|
+
pure subroutine swap_real(a, b)
|
|
423
|
+
|
|
424
|
+
! Dummy arguments
|
|
425
|
+
real(wp), intent(inout) :: a, b
|
|
426
|
+
|
|
427
|
+
! Local variables
|
|
428
|
+
real(wp) temp
|
|
429
|
+
|
|
430
|
+
temp = a ; a = b ; b = temp
|
|
431
|
+
|
|
432
|
+
end subroutine swap_real
|
|
433
|
+
|
|
434
|
+
pure subroutine swap_complex(a, b)
|
|
435
|
+
|
|
436
|
+
! Dummy arguments
|
|
437
|
+
complex(wp), intent(inout) :: a, b
|
|
438
|
+
|
|
439
|
+
! Local variables
|
|
440
|
+
complex(wp) temp
|
|
441
|
+
|
|
442
|
+
temp = a ; a = b ; b = temp
|
|
443
|
+
|
|
444
|
+
end subroutine swap_complex
|
|
445
|
+
|
|
446
|
+
pure subroutine swap_integer(a, b)
|
|
447
|
+
|
|
448
|
+
! Dummy arguments
|
|
449
|
+
integer(ip), intent(inout) :: a, b
|
|
450
|
+
|
|
451
|
+
! Local variables
|
|
452
|
+
integer(ip) temp
|
|
453
|
+
|
|
454
|
+
temp = a ; a = b ; b = temp
|
|
455
|
+
|
|
456
|
+
end subroutine swap_integer
|
|
457
|
+
|
|
458
|
+
pure subroutine swap_character(a, b)
|
|
459
|
+
|
|
460
|
+
! Dummy arguments
|
|
461
|
+
character, intent(inout) :: a, b
|
|
462
|
+
|
|
463
|
+
! Local variables
|
|
464
|
+
character temp
|
|
465
|
+
|
|
466
|
+
temp = a
|
|
467
|
+
a = b
|
|
468
|
+
b = temp
|
|
469
|
+
|
|
470
|
+
end subroutine swap_character
|
|
471
|
+
|
|
472
|
+
end module type_CyclicReductionUtility
|