@ -293,7 +293,7 @@ contains
! local variables
! local variables
type ( psb_sspmat_type ) :: a
type ( psb_sspmat_type ) :: a
real ( psb_spk_ ) :: zt ( nbmax ) , glob_x , glob_y , glob_z
real ( psb_spk_ ) :: zt ( nbmax ) , glob_x , glob_y , glob_z
integer :: m , n , nnz , glob_row
integer :: m , n , nnz , glob_row , ipoints
integer :: x , y , z , ia , indx_owner
integer :: x , y , z , ia , indx_owner
integer :: np , iam
integer :: np , iam
integer :: element
integer :: element
@ -318,12 +318,13 @@ contains
call psb_info ( ictxt , iam , np )
call psb_info ( ictxt , iam , np )
deltah = 1. e 0/ ( idim - 1 )
deltah = 1. d 0/ ( idim - 1 )
! initialize array descriptor and sparse matrix storage ; provide an
! initialize array descriptor and sparse matrix storage ; provide an
! estimate of the number of non zeroes
! estimate of the number of non zeroes
m = idim * idim * idim
ipoints = idim - 2
m = ipoints * ipoints * ipoints
n = m
n = m
nnz = ( ( n * 9 ) / ( np ) )
nnz = ( ( n * 9 ) / ( np ) )
if ( iam == psb_root_ ) write ( 0 , '("Generating Matrix (size=",i0x,")...")' ) n
if ( iam == psb_root_ ) write ( 0 , '("Generating Matrix (size=",i0x,")...")' ) n
@ -351,14 +352,13 @@ contains
go to 9999
go to 9999
endif
endif
tins = 0. e 0
tins = 0. d 0
call psb_barrier ( ictxt )
call psb_barrier ( ictxt )
t1 = psb_wtime ( )
t1 = psb_wtime ( )
! loop over rows belonging to current process in a block
! loop over rows belonging to current process in a block
! distribution .
! distribution .
! icol ( 1 ) = 1
do glob_row = 1 , n
do glob_row = 1 , n
call parts ( glob_row , n , np , prv , nv )
call parts ( glob_row , n , np , prv , nv )
do inv = 1 , nv
do inv = 1 , nv
@ -367,24 +367,24 @@ contains
! local matrix pointer
! local matrix pointer
element = 1
element = 1
! compute gridpoint coordinates
! compute gridpoint coordinates
if ( mod ( glob_row , ( idim * idim ) ) == 0 ) then
if ( mod ( glob_row , ipoints * ipoints ) == 0 ) then
x = glob_row / ( idim * idim )
x = glob_row / ( ipoints * ipoints )
else
else
x = glob_row / ( idim * idim ) + 1
x = glob_row / ( ipoints * ipoints ) + 1
endif
endif
if ( mod ( ( glob_row - ( x - 1 ) * idim * idim ) , idim ) == 0 ) then
if ( mod ( ( glob_row - ( x - 1 ) * ipoints * ipoints ) , ipoints ) == 0 ) then
y = ( glob_row - ( x - 1 ) * idim * idim ) / idim
y = ( glob_row - ( x - 1 ) * ipoints * ipoints ) / ipoints
else
else
y = ( glob_row - ( x - 1 ) * idim * idim ) / idim + 1
y = ( glob_row - ( x - 1 ) * ipoints * ipoints ) / ipoints + 1
endif
endif
z = glob_row - ( x - 1 ) * idim * idim - ( y - 1 ) * idim
z = glob_row - ( x - 1 ) * ipoints * ipoints - ( y - 1 ) * ipoints
! glob_x , glob_y , glob_x coordinates
! glob_x , glob_y , glob_x coordinates
glob_x = x * deltah
glob_x = x * deltah
glob_y = y * deltah
glob_y = y * deltah
glob_z = z * deltah
glob_z = z * deltah
! check on boundary points
! check on boundary points
zt ( 1 ) = 0. e 0
zt ( 1 ) = 0. d 0
! internal point : build discretization
! internal point : build discretization
!
!
! term depending on ( x - 1 , y , z )
! term depending on ( x - 1 , y , z )
@ -400,7 +400,7 @@ contains
& - a1 ( glob_x , glob_y , glob_z )
& - a1 ( glob_x , glob_y , glob_z )
val ( element ) = val ( element ) / ( deltah * &
val ( element ) = val ( element ) / ( deltah * &
& deltah )
& deltah )
icol ( element ) = ( x - 2 ) * idim * idim + ( y - 1 ) * idim + ( z )
icol ( element ) = ( x - 2 ) * ipoints * ipoints + ( y - 1 ) * ipoints + ( z )
element = element + 1
element = element + 1
endif
endif
! term depending on ( x , y - 1 , z )
! term depending on ( x , y - 1 , z )
@ -409,13 +409,13 @@ contains
& - a2 ( glob_x , glob_y , glob_z )
& - a2 ( glob_x , glob_y , glob_z )
val ( element ) = val ( element ) / ( deltah * &
val ( element ) = val ( element ) / ( deltah * &
& deltah )
& deltah )
zt ( 1 ) = exp ( - glob_ y ** 2 - glob_z ** 2 ) * exp ( - glob_x ) * ( - val ( element ) )
zt ( 1 ) = exp ( - glob_ x ** 2 - glob_z ** 2 ) * ( - val ( element ) )
else
else
val ( element ) = - b2 ( glob_x , glob_y , glob_z ) &
val ( element ) = - b2 ( glob_x , glob_y , glob_z ) &
& - a2 ( glob_x , glob_y , glob_z )
& - a2 ( glob_x , glob_y , glob_z )
val ( element ) = val ( element ) / ( deltah * &
val ( element ) = val ( element ) / ( deltah * &
& deltah )
& deltah )
icol ( element ) = ( x - 1 ) * idim * idim + ( y - 2 ) * idim + ( z )
icol ( element ) = ( x - 1 ) * ipoints * ipoints + ( y - 2 ) * ipoints + ( z )
element = element + 1
element = element + 1
endif
endif
! term depending on ( x , y , z - 1 )
! term depending on ( x , y , z - 1 )
@ -424,13 +424,13 @@ contains
& - a3 ( glob_x , glob_y , glob_z )
& - a3 ( glob_x , glob_y , glob_z )
val ( element ) = val ( element ) / ( deltah * &
val ( element ) = val ( element ) / ( deltah * &
& deltah )
& deltah )
zt ( 1 ) = exp ( - glob_ y** 2 - glob_z ** 2 ) * exp ( - glob_x ) * ( - val ( element ) )
zt ( 1 ) = exp ( - glob_ x** 2 - glob_y ** 2 ) * ( - val ( element ) )
else
else
val ( element ) = - b3 ( glob_x , glob_y , glob_z ) &
val ( element ) = - b3 ( glob_x , glob_y , glob_z ) &
& - a3 ( glob_x , glob_y , glob_z )
& - a3 ( glob_x , glob_y , glob_z )
val ( element ) = val ( element ) / ( deltah * &
val ( element ) = val ( element ) / ( deltah * &
& deltah )
& deltah )
icol ( element ) = ( x - 1 ) * idim * idim + ( y - 1 ) * idim + ( z - 1 )
icol ( element ) = ( x - 1 ) * ipoints * ipoints + ( y - 1 ) * ipoints + ( z - 1 )
element = element + 1
element = element + 1
endif
endif
! term depending on ( x , y , z )
! term depending on ( x , y , z )
@ -442,40 +442,45 @@ contains
& + a3 ( glob_x , glob_y , glob_z )
& + a3 ( glob_x , glob_y , glob_z )
val ( element ) = val ( element ) / ( deltah * &
val ( element ) = val ( element ) / ( deltah * &
& deltah )
& deltah )
icol ( element ) = ( x - 1 ) * idim * idim + ( y - 1 ) * idim + ( z )
icol ( element ) = ( x - 1 ) * ipoints * ipoints + ( y - 1 ) * ipoints + ( z )
element = element + 1
element = element + 1
! term depending on ( x , y , z + 1 )
! term depending on ( x , y , z + 1 )
if ( z == idim ) then
if ( z == ipoints ) then
val ( element ) = - b1 ( glob_x , glob_y , glob_z )
val ( element ) = - b1 ( glob_x , glob_y , glob_z )
val ( element ) = val ( element ) / ( deltah * &
val ( element ) = val ( element ) / ( deltah * &
& deltah )
& deltah )
zt ( 1 ) = exp ( - glob_ y** 2 - glob_z ** 2 ) * exp ( - glob_x ) * ( - val ( element ) )
zt ( 1 ) = exp ( - glob_ x** 2 - glob_y ** 2 ) * exp ( - glob_z ) * ( - val ( element ) )
else
else
val ( element ) = - b1 ( glob_x , glob_y , glob_z )
val ( element ) = - b1 ( glob_x , glob_y , glob_z )
val ( element ) = val ( element ) / ( deltah * &
val ( element ) = val ( element ) / ( deltah * &
& deltah )
& deltah )
icol ( element ) = ( x - 1 ) * idim * idim + ( y - 1 ) * idim + ( z + 1 )
icol ( element ) = ( x - 1 ) * ipoints * ipoints + ( y - 1 ) * ipoints + ( z + 1 )
element = element + 1
element = element + 1
endif
endif
! term depending on ( x , y + 1 , z )
! term depending on ( x , y + 1 , z )
if ( y == idim ) then
if ( y == ipoints ) then
val ( element ) = - b2 ( glob_x , glob_y , glob_z )
val ( element ) = - b2 ( glob_x , glob_y , glob_z )
val ( element ) = val ( element ) / ( deltah * &
val ( element ) = val ( element ) / ( deltah * &
& deltah )
& deltah )
zt ( 1 ) = exp ( - glob_ y ** 2 - glob_z ** 2 ) * exp ( - glob_ x ) * ( - val ( element ) )
zt ( 1 ) = exp ( - glob_ x ** 2 - glob_z ** 2 ) * exp ( - glob_ y ) * ( - val ( element ) )
else
else
val ( element ) = - b2 ( glob_x , glob_y , glob_z )
val ( element ) = - b2 ( glob_x , glob_y , glob_z )
val ( element ) = val ( element ) / ( deltah * &
val ( element ) = val ( element ) / ( deltah * &
& deltah )
& deltah )
icol ( element ) = ( x - 1 ) * idim * idim + ( y ) * idim + ( z )
icol ( element ) = ( x - 1 ) * ipoints * ipoints + ( y ) * ipoints + ( z )
element = element + 1
element = element + 1
endif
endif
! term depending on ( x + 1 , y , z )
! term depending on ( x + 1 , y , z )
if ( x < idim ) then
if ( x == ipoints ) then
val ( element ) = - b3 ( glob_x , glob_y , glob_z )
val ( element ) = val ( element ) / ( deltah * &
& deltah )
zt ( 1 ) = exp ( - glob_y ** 2 - glob_z ** 2 ) * exp ( - glob_x ) * ( - val ( element ) )
else
val ( element ) = - b3 ( glob_x , glob_y , glob_z )
val ( element ) = - b3 ( glob_x , glob_y , glob_z )
val ( element ) = val ( element ) / ( deltah * &
val ( element ) = val ( element ) / ( deltah * &
& deltah )
& deltah )
icol ( element ) = ( x ) * idim * idim + ( y - 1 ) * idim + ( z )
icol ( element ) = ( x ) * ipoints * ipoints + ( y - 1 ) * ipoints + ( z )
element = element + 1
element = element + 1
endif
endif
irow ( 1 : element - 1 ) = glob_row
irow ( 1 : element - 1 ) = glob_row
@ -487,7 +492,7 @@ contains
tins = tins + ( psb_wtime ( ) - t3 )
tins = tins + ( psb_wtime ( ) - t3 )
call psb_geins ( 1 , ( / ia / ) , zt ( 1 : 1 ) , b , desc_a , info )
call psb_geins ( 1 , ( / ia / ) , zt ( 1 : 1 ) , b , desc_a , info )
if ( info / = 0 ) exit
if ( info / = 0 ) exit
zt ( 1 ) = 0. e 0
zt ( 1 ) = 0. d 0
call psb_geins ( 1 , ( / ia / ) , zt ( 1 : 1 ) , xv , desc_a , info )
call psb_geins ( 1 , ( / ia / ) , zt ( 1 : 1 ) , xv , desc_a , info )
if ( info / = 0 ) exit
if ( info / = 0 ) exit
end if
end if