-
Notifications
You must be signed in to change notification settings - Fork 1
/
inverter_utils.F90
56 lines (48 loc) · 1.77 KB
/
inverter_utils.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
module inverter_utils
use params
implicit none
complex(dp) :: xout(kthird, 0:ksizex_l + 1, 0:ksizey_l + 1, 0:ksizet_l + 1, 4)
contains
! For the multi-shift inverter
subroutine dirac_op_shifted(xout, xin, u, am, imass, shift)
complex(dp), intent(out) :: xout(kthird, 0:ksizex_l + 1, 0:ksizey_l + 1, 0:ksizet_l + 1, 4)
complex(dp), intent(in) :: xin(kthird, 0:ksizex_l + 1, 0:ksizey_l + 1, 0:ksizet_l + 1, 4)
complex(dp), intent(in) :: u(0:ksizex_l + 1, 0:ksizey_l + 1, 0:ksizet_l + 1, 3)
real, intent(in) :: am, shift
integer, intent(in) :: imass
call dirac_operator(xout, xin, u, am, imass)
xout = (xout + shift*xin)
end subroutine
subroutine dirac_operator(xout, xin, u, am, imass)
use dirac, only: dslash, dslashd
use comms
#ifdef MPI
use comms5, only: start_halo_update_5
#else
use comms5, only: update_halo_5
#endif
complex(dp), intent(out) :: xout(kthird, 0:ksizex_l + 1, 0:ksizey_l + 1, 0:ksizet_l + 1, 4)
complex(dp), intent(in) :: xin(kthird, 0:ksizex_l + 1, 0:ksizey_l + 1, 0:ksizet_l + 1, 4)
complex(dp), intent(in) :: u(0:ksizex_l + 1, 0:ksizey_l + 1, 0:ksizet_l + 1, 3)
real, intent(in) :: am
integer, intent(in) :: imass
#ifdef MPI
integer, dimension(12) :: reqs_xtemp, reqs_xout
#endif
complex(dp) :: xtemp(kthird, 0:ksizex_l + 1, 0:ksizey_l + 1, 0:ksizet_l + 1, 4)
call dslash(xtemp, xin, u, am, imass)
#ifdef MPI
call start_halo_update_5(4, xtemp, 8, reqs_xtemp)
call complete_halo_update(reqs_xtemp)
#else
call update_halo_5(4, xtemp)
#endif
call dslashd(xout, xtemp, u, am, imass)
#ifdef MPI
call start_halo_update_5(4, xout, 10, reqs_xout)
call complete_halo_update(reqs_xout)
#else
call update_halo_5(4, xout)
#endif
end subroutine dirac_operator
end module