Statistics
| Branch: | Revision:

root / synthbench / euroben-dm / mod2cr / .svn / text-base / sym7pre.f.svn-base @ 0:839f52ef7657

History | View | Annotate | Download (2.3 kB)

1
      Subroutine sym7pre( m, n1, n2, n3, a, b, fac )
2
! ---------------------------------------------------------------------
3
! --- sym7pre computes the inverse of D as used in the preconditioners.
4
!     Also the elements of A and RHS b are adjusted.
5
!     Note that Inv(D) is approximate as no elements of A of
6
!     other processors are used in order to keep communication
7
!     within reasonable bounds.
8
! ---------------------------------------------------------------------
9
      Use         numerics
10
      Use         mpi_module
11
      Use         floptime
12
      Implicit    None
13

    
14
      Integer  :: m, n1 ,n2 ,n3
15
      Real(l_) :: a(m,0:3), b(n1*n2*n3), fac(n1*n2*n3)
16

    
17
      Integer  :: i, inm, in12, ntot, n12
18
! ---------------------------------------------------------------------
19
      n12  = n1*n2
20
      ntot = n12*n3
21
      fac(lb) = 1.0_l_/a(1,0)
22
      Do i = 2, m
23
         inm    = i - 1
24
         fac(glb+i) = a(i,0) - fac(glb+inm)*a(inm,1)*a(inm,1)
25
      End Do
26
      Do i = n1 + 1, m
27
         inm    = i - n1
28
         fac(glb+i) = fac(glb+i) - fac(glb+inm)*a(inm,2)*a(inm,2)
29
      End Do
30
      Do i = n12 + 1, m
31
         inm    = i - n12
32
         fac(glb+i) = fac(glb+i) - fac(glb+inm)*a(inm,3)*a(inm,3)
33
      End Do
34
      fac(lb:gub) = 1.0_l_/fac(lb:gub)
35
! ---------------------------------------------------------------------
36
! --- D-inverse is now complete, scale A and b.
37

    
38
      a(1:m,0) = a(1:m,0)*fac(lb:gub)
39
      fac(lb:gub) = Sqrt( fac(lb:gub) )
40
      b(lb:gub)   = b(lb:gub)*fac(lb:gub)
41
      Do i = 2, m
42
         inm      = i - 1
43
         a(inm,1) = fac(glb+i)*fac(glb+inm)*a(inm,1)
44
      End Do
45
      Do i = n1 + 1, m
46
         inm      = i - n1
47
         a(inm,2) = fac(glb+i)*fac(glb+inm)*a(inm,2)
48
      End Do
49
      Do i = n12 + 1, m
50
         inm     = i - n12
51
         a(inm,3) = fac(glb+i)*fac(glb+inm)*a(inm,3)
52
      End Do
53
      Call MPI_Allgatherv( fac(lb), m, rtyp, fac, sizes, offset, rtyp,
54
     &                     comm, ierr )
55
      Call MPI_Allgatherv( b(lb), m, rtyp, b, sizes, offset, rtyp,
56
     &                     comm, ierr )
57
      flops = flops + 25*m - 6*( n1 + n12 ) - 5 ! <-- No. of flops.
58
! ---------------------------------------------------------------------
59
! --- Keep fac for backscaling the solution x.
60
! ---------------------------------------------------------------------
61
      End Subroutine sym7pre