SUBROUTINE store3 ! Store elements of matrix as row-indexed sparse storage mode ! IA is the row index of coefficient matrix, (1,2*JM2*JM2) ! i & j are index of grid array, (2,JM1) ! i index is changed most rapidly ! k is index of row-indexed sparse array ! ija(k) is the column number of coefficient in coefficient matrix ! zero elements of near off-diagonal are stored, make sure they are initialized. ! sa(k) stores the nonzero values of the coefficient matrix INCLUDE 'include3.inc' NN=2*JM2*JM2 j=2 i=1 do IA=1,NN-1,2 i=i+1 if(i.gt.JM1)then i=2 j=j+1 endif do m=1,2 if(m.eq.1)then sa(IA)=e(i,j,m,m) ! Store diagonal elements else sa(IA+1)=e(i,j,m,m) ! Store diagonal elements endif enddo enddo ija(1)=NN+2 ! Store size of matrix + 2 k=NN+1 j=2 i=1 do IA=1,NN-1,2 ! IA is sequence number for first equation of pair ! i.e., It is row counter for coefficient matrix i=i+1 if(i.gt.JM1)then i=2 j=j+1 endif ! Store off-diagonal coefficients do m=1,2 k=k+1 if(m.eq.1)then sa(k)=e(i,j,1,2) ! Store coupling on diagonal ija(k)=IA+1 else sa(k)=e(i,j,2,1) ! Store coupling on diagonal ija(k)=IA endif ! if(j.gt.2)then if(m.eq.1)then k=k+1 sa(k)=d(i,j,1,1) ! Store j-1 coefficient ija(k)=IA-2*JM2 k=k+1 sa(k)=d(i,j,1,2) ! Store j-1 coefficient ija(k)=IA-2*JM2+1 else k=k+1 sa(k)=d(i,j,2,1) ! Store j-1 coefficient ija(k)=IA-2*JM2 k=k+1 sa(k)=d(i,j,2,2) ! Store j-1 coefficient ija(k)=IA-2*JM2+1 endif endif if(i.gt.2)then if(m.eq.1)then k=k+1 sa(k)=b(i,j,1,1) ! Store i-1 coefficient ija(k)=IA-2 k=k+1 sa(k)=b(i,j,1,2) ! Store i-1 coefficient ija(k)=IA-1 else k=k+1 sa(k)=b(i,j,2,1) ! Store i-1 coefficient ija(k)=IA-2 k=k+1 sa(k)=b(i,j,2,2) ! Store i-1 coefficient ija(k)=IA-1 endif endif if(i.lt.JM1)then if(m.eq.1)then k=k+1 sa(k)=a(i,j,1,1) ! Store i+1 coefficient ija(k)=IA+2 k=k+1 sa(k)=a(i,j,1,2) ! Store i+1 coefficient ija(k)=IA+3 else k=k+1 sa(k)=a(i,j,2,1) ! Store i+1 coefficient ija(k)=IA+2 k=k+1 sa(k)=a(i,j,2,2) ! Store i+1 coefficient ija(k)=IA+3 endif endif if(j.lt.JM1)then if(m.eq.1)then k=k+1 sa(k)=c(i,j,1,1) ! Store j+1 coefficient ija(k)=IA+2*JM2 k=k+1 sa(k)=c(i,j,1,2) ! Store j+1 coefficient ija(k)=IA+2*JM2+1 else k=k+1 sa(k)=c(i,j,2,1) ! Store j+1 coefficient ija(k)=IA+2*JM2 k=k+1 sa(k)=c(i,j,2,2) ! Store j+1 coefficient ija(k)=IA+2*JM2+1 endif endif if(m.eq.1)then ija(IA+1)=k+1 ! As each row is completed, store index to next else ija(IA+2)=k+1 ! As each row is completed, store index to next endif enddo ! End of loop on m enddo ! End of loop on rows RETURN END