root / synthbench / euroben-dm / mod2cr / sym7icg0.f @ 0:839f52ef7657
History | View | Annotate | Download (2.3 kB)
1 |
Subroutine sym7icg0( n1, n2, n3, m, mp, a, al, rmr, x, y, gamma ) |
---|---|
2 |
! --------------------------------------------------------------------- |
3 |
! --- ILU0 preconditioner. gamma is not used in this routine as |
4 |
! this parameter is only relevant for polynomial preconditioning. |
5 |
! --- Note that this preconditioning is VERY approximate: the local |
6 |
! parts of the matrix are treated as a complete matrix. So, |
7 |
! influence of non-local parts is neglected. |
8 |
! --------------------------------------------------------------------- |
9 |
|
10 |
Use numerics |
11 |
Use floptime |
12 |
Use mpi_module |
13 |
Implicit None |
14 |
|
15 |
Integer :: n1, n2, n3, m, mp |
16 |
Real(l_) :: a(m,0:3), al(m,1:3), rmr, x(n1*n2*n3), y(n1*n2*n3) |
17 |
Real(l_) :: gamma(mp+1) |
18 |
|
19 |
Real(l_) :: nrm2 |
20 |
External nrm2 |
21 |
|
22 |
Integer :: i, n12 |
23 |
! --------------------------------------------------------------------- |
24 |
! --- Forward solve: Corner. |
25 |
|
26 |
Call MPI_Allgatherv( x(lb), m, rtyp, x, sizes, offset, rtyp, |
27 |
& comm, ierr ) |
28 |
y = 0.0_l_ |
29 |
y(lb) = x(lb) ! <-- Inexactness starts here! |
30 |
! --------------------------------------------------------------------- |
31 |
! --- Forward solve: Rest. |
32 |
|
33 |
n12 = n1*n2 |
34 |
y(glb+lb1:glb+ub1) = x(glb+lb1:glb+ub1) - al(lb1:ub1,1)* |
35 |
& y(glb+lb1-1:glb+ub1-1) |
36 |
y(glb+lb2:glb+ub2) = y(glb+lb2:glb+ub2) - al(lb2:ub2,2)* |
37 |
& y(glb+lb2-1:glb+ub2-n1) |
38 |
y(glb+lb3:glb+ub3) = y(glb+lb3:glb+ub3) - al(lb3:ub3,3)* |
39 |
& y(glb+lb3-1:glb+ub3-n12) |
40 |
! --------------------------------------------------------------------- |
41 |
! --- Computation of (r,Mr) where M is the preconditioner. |
42 |
|
43 |
rmr = nrm2( m, y(lb) ) |
44 |
! --------------------------------------------------------------------- |
45 |
! --- Back solve: |
46 |
|
47 |
Do i = ua1 - 1, la1, -1 |
48 |
y(glb+i) = y(glb+i) - a(i,1)*y(glb+i+1) |
49 |
End Do |
50 |
Do i = ua2 - 1, la2, -1 |
51 |
y(glb+i) = y(glb+i) - a(i,2)*y(glb+i+n1) |
52 |
End Do |
53 |
Do i = ua3 - 1, la3, -1 |
54 |
y(glb+i) = y(glb+i) - a(i,3)*y(glb+i+n12) |
55 |
End Do |
56 |
|
57 |
flops = flops + 5*( n1 - 1 ) + 9*( n12 - n1 ) + 13*( m - n12 ) |
58 |
& + 2*m |
59 |
! --------------------------------------------------------------------- |
60 |
End Subroutine sym7icg0 |