|
|
|
@ -64,11 +64,11 @@
|
|
|
|
|
! level 1 is the finest level and A(1) is the matrix A.
|
|
|
|
|
!
|
|
|
|
|
! For a general description of (parallel) multilevel preconditioners see
|
|
|
|
|
! 1. B.F. Smith, P.E. Bjorstad & W.D. Gropp,
|
|
|
|
|
! - B.F. Smith, P.E. Bjorstad & W.D. Gropp,
|
|
|
|
|
! Domain decomposition: parallel multilevel methods for elliptic partial
|
|
|
|
|
! differential equations,
|
|
|
|
|
! Cambridge University Press, 1996.
|
|
|
|
|
! 2. K. Stuben,
|
|
|
|
|
! - K. Stuben,
|
|
|
|
|
! Algebraic Multigrid (AMG): An Introduction with Applications,
|
|
|
|
|
! GMD Report N. 70, 1999.
|
|
|
|
|
!
|
|
|
|
@ -113,11 +113,11 @@
|
|
|
|
|
! The real parameters defining the base preconditioner
|
|
|
|
|
! K(ilev).
|
|
|
|
|
! baseprecv(ilev)%perm - integer, dimension(:), allocatable.
|
|
|
|
|
! The row and column permutations applied to the local
|
|
|
|
|
! The row and column permutations applied to the local
|
|
|
|
|
! part of A(ilev) (defined only if baseprecv(ilev)%
|
|
|
|
|
! iprcparm(mld_sub_ren_)>0).
|
|
|
|
|
! baseprecv(ilev)%invperm - integer, dimension(:), allocatable.
|
|
|
|
|
! The inverse of the permutation stored in
|
|
|
|
|
! The inverse of the permutation stored in
|
|
|
|
|
! baseprecv(ilev)%perm.
|
|
|
|
|
! baseprecv(ilev)%mlia - integer, dimension(:), allocatable.
|
|
|
|
|
! The aggregation map (ilev-1) --> (ilev).
|
|
|
|
@ -182,7 +182,7 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
! Local variables
|
|
|
|
|
integer :: n_row,n_col
|
|
|
|
|
integer :: ictxt,np,me,i, nr2l,nc2l,err_act
|
|
|
|
|
logical, parameter :: debug=.false., debugprt=.false.
|
|
|
|
|
integer :: debug_level, debug_unit
|
|
|
|
|
integer :: ismth, nlev, ilev, icm
|
|
|
|
|
character(len=20) :: name
|
|
|
|
|
|
|
|
|
@ -194,12 +194,15 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
name='mld_dmlprec_aply'
|
|
|
|
|
info = 0
|
|
|
|
|
call psb_erractionsave(err_act)
|
|
|
|
|
debug_unit = psb_get_debug_unit()
|
|
|
|
|
debug_level = psb_get_debug_level()
|
|
|
|
|
|
|
|
|
|
ictxt = psb_cd_get_context(desc_data)
|
|
|
|
|
call psb_info(ictxt, me, np)
|
|
|
|
|
|
|
|
|
|
if (debug) write(0,*) me,'Entry to mlprec_aply ',&
|
|
|
|
|
& size(baseprecv)
|
|
|
|
|
if (debug_level >= psb_debug_inner_) &
|
|
|
|
|
& write(debug_unit,*) me,' ',trim(name),&
|
|
|
|
|
& ' Entry ', size(baseprecv)
|
|
|
|
|
|
|
|
|
|
nlev = size(baseprecv)
|
|
|
|
|
allocate(mlprec_wrk(nlev),stat=info)
|
|
|
|
@ -215,7 +218,7 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
!
|
|
|
|
|
! No preconditioning, should not really get here
|
|
|
|
|
!
|
|
|
|
|
call psb_errpush(4010,name,a_err='mld_no_ml_ in mlprc_aply?')
|
|
|
|
|
call psb_errpush(4001,name,a_err='mld_no_ml_ in mlprc_aply?')
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -260,7 +263,10 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
!
|
|
|
|
|
call mld_baseprec_aply(alpha,baseprecv(1),x,beta,y,&
|
|
|
|
|
& baseprecv(1)%base_desc,trans,work,info)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
if (info /=0) then
|
|
|
|
|
call psb_errpush(4010,name,a_err='baseprec_aply')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
allocate(mlprec_wrk(1)%x2l(size(x)),mlprec_wrk(1)%y2l(size(y)), stat=info)
|
|
|
|
|
if (info /= 0) then
|
|
|
|
@ -308,11 +314,8 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
!
|
|
|
|
|
call psb_halo(mlprec_wrk(ilev-1)%x2l,baseprecv(ilev-1)%base_desc,&
|
|
|
|
|
& info,work=work)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
call psb_csmm(done,baseprecv(ilev)%av(mld_sm_pr_t_),mlprec_wrk(ilev-1)%x2l,&
|
|
|
|
|
& dzero,mlprec_wrk(ilev)%x2l,info)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
|
|
|
|
|
if (info == 0) call psb_csmm(done,baseprecv(ilev)%av(mld_sm_pr_t_),&
|
|
|
|
|
& mlprec_wrk(ilev-1)%x2l,dzero,mlprec_wrk(ilev)%x2l,info)
|
|
|
|
|
else
|
|
|
|
|
!
|
|
|
|
|
! Apply the raw aggregation map transpose (take a shortcut)
|
|
|
|
@ -324,11 +327,19 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
if (info /=0) then
|
|
|
|
|
call psb_errpush(4001,name,a_err='Error during restriction')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (icm == mld_repl_mat_) then
|
|
|
|
|
call psb_sum(ictxt,mlprec_wrk(ilev)%x2l(1:nr2l))
|
|
|
|
|
else if (icm /= mld_distr_mat_) then
|
|
|
|
|
write(0,*) 'Unknown value for baseprecv(2)%iprcparm(mld_coarse_mat_) ',icm
|
|
|
|
|
info = 4013
|
|
|
|
|
call psb_errpush(info,name,a_err='invalid mld_coarse_mat_',&
|
|
|
|
|
& i_Err=(/icm,0,0,0,0/))
|
|
|
|
|
goto 9999
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
@ -361,8 +372,6 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
!
|
|
|
|
|
call psb_csmm(done,baseprecv(ilev)%av(mld_sm_pr_),mlprec_wrk(ilev)%y2l,&
|
|
|
|
|
& done,mlprec_wrk(ilev-1)%y2l,info)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
!
|
|
|
|
|
! Apply the raw aggregation map (take a shortcut)
|
|
|
|
@ -373,6 +382,10 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
enddo
|
|
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
if (info /=0) then
|
|
|
|
|
call psb_errpush(4001,name,a_err='Error during prolognation')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
@ -381,8 +394,10 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
! Compute the output vector Y
|
|
|
|
|
!
|
|
|
|
|
call psb_geaxpby(alpha,mlprec_wrk(1)%y2l,done,y,baseprecv(1)%base_desc,info)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
|
|
|
|
|
if (info /= 0) then
|
|
|
|
|
call psb_errpush(4001,name,a_err='Error on final update')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
case(mld_mult_ml_)
|
|
|
|
|
|
|
|
|
@ -432,8 +447,9 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
!
|
|
|
|
|
! Copy the input vector X
|
|
|
|
|
!
|
|
|
|
|
if (debug) write(0,*) me, 'mlprec_aply desc_data',&
|
|
|
|
|
& allocated(desc_data%matrix_data)
|
|
|
|
|
if (debug_level >= psb_debug_inner_) &
|
|
|
|
|
& write(debug_unit,*) me,' ',trim(name),&
|
|
|
|
|
& ' desc_data status',allocated(desc_data%matrix_data)
|
|
|
|
|
|
|
|
|
|
n_col = psb_cd_get_local_cols(desc_data)
|
|
|
|
|
nc2l = psb_cd_get_local_cols(baseprecv(1)%desc_data)
|
|
|
|
@ -442,7 +458,7 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
& mlprec_wrk(1)%tx(nc2l), stat=info)
|
|
|
|
|
mlprec_wrk(1)%x2l(:) = dzero
|
|
|
|
|
mlprec_wrk(1)%y2l(:) = dzero
|
|
|
|
|
mlprec_wrk(1)%tx(:) = dzero
|
|
|
|
|
mlprec_wrk(1)%tx(:) = dzero
|
|
|
|
|
|
|
|
|
|
call psb_geaxpby(done,x,dzero,mlprec_wrk(1)%tx,&
|
|
|
|
|
& baseprecv(1)%base_desc,info)
|
|
|
|
@ -463,7 +479,9 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
ismth = baseprecv(ilev)%iprcparm(mld_aggr_kind_)
|
|
|
|
|
icm = baseprecv(ilev)%iprcparm(mld_coarse_mat_)
|
|
|
|
|
|
|
|
|
|
if (debug) write(0,*) me, 'mlprec_aply starting up sweep ',&
|
|
|
|
|
if (debug_level >= psb_debug_inner_) &
|
|
|
|
|
& write(debug_unit,*) me,' ',trim(name), &
|
|
|
|
|
& ' starting up sweep ',&
|
|
|
|
|
& ilev,allocated(baseprecv(ilev)%iprcparm),n_row,n_col,&
|
|
|
|
|
& nc2l, nr2l,ismth
|
|
|
|
|
|
|
|
|
@ -479,21 +497,19 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
|
|
|
|
|
mlprec_wrk(ilev)%x2l(:) = dzero
|
|
|
|
|
mlprec_wrk(ilev)%y2l(:) = dzero
|
|
|
|
|
mlprec_wrk(ilev)%tx(:) = dzero
|
|
|
|
|
mlprec_wrk(ilev)%tx(:) = dzero
|
|
|
|
|
|
|
|
|
|
if (ismth /= mld_no_smooth_) then
|
|
|
|
|
!
|
|
|
|
|
! Apply the smoothed prolongator transpose
|
|
|
|
|
!
|
|
|
|
|
if (debug) write(0,*) me, 'mlprec_aply halo in up sweep ', ilev
|
|
|
|
|
if (debug_level >= psb_debug_inner_) &
|
|
|
|
|
& write(debug_unit,*) me,' ',trim(name), ' up sweep ', ilev
|
|
|
|
|
|
|
|
|
|
call psb_halo(mlprec_wrk(ilev-1)%x2l,&
|
|
|
|
|
& baseprecv(ilev-1)%base_desc,info,work=work)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
if (debug) write(0,*) me, 'mlprec_aply csmm in up sweep ', ilev
|
|
|
|
|
call psb_csmm(done,baseprecv(ilev)%av(mld_sm_pr_t_),mlprec_wrk(ilev-1)%x2l, &
|
|
|
|
|
& dzero,mlprec_wrk(ilev)%x2l,info)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
|
|
|
|
|
if (info == 0) call psb_csmm(done,baseprecv(ilev)%av(mld_sm_pr_t_),&
|
|
|
|
|
& mlprec_wrk(ilev-1)%x2l,dzero,mlprec_wrk(ilev)%x2l,info)
|
|
|
|
|
else
|
|
|
|
|
!
|
|
|
|
|
! Apply the raw aggregation map transpose (take a shortcut)
|
|
|
|
@ -505,20 +521,18 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if (debug) write(0,*) me, 'mlprec_aply possible sum in up sweep ', &
|
|
|
|
|
& ilev,icm,associated(baseprecv(ilev)%base_desc),mld_repl_mat_
|
|
|
|
|
if (debug) write(0,*) me, 'mlprec_aply geaxpby in up sweep X', &
|
|
|
|
|
& ilev,associated(baseprecv(ilev)%base_desc),&
|
|
|
|
|
& baseprecv(ilev)%base_desc%matrix_data(psb_n_row_),&
|
|
|
|
|
& baseprecv(ilev)%base_desc%matrix_data(psb_n_col_),&
|
|
|
|
|
& size(mlprec_wrk(ilev)%tx),size(mlprec_wrk(ilev)%x2l)
|
|
|
|
|
if (info /=0) then
|
|
|
|
|
call psb_errpush(4001,name,a_err='Error during restriction')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if (icm == mld_repl_mat_) Then
|
|
|
|
|
if (debug) write(0,*) 'Entering psb_sum ',nr2l
|
|
|
|
|
call psb_sum(ictxt,mlprec_wrk(ilev)%x2l(1:nr2l))
|
|
|
|
|
else if (icm /= mld_distr_mat_) Then
|
|
|
|
|
write(0,*) 'Unknown value for baseprecv(2)%iprcparm(mld_coarse_mat_) ', icm
|
|
|
|
|
info = 4013
|
|
|
|
|
call psb_errpush(info,name,a_err='invalid mld_coarse_mat_',&
|
|
|
|
|
& i_Err=(/icm,0,0,0,0/))
|
|
|
|
|
goto 9999
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
@ -526,9 +540,14 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
!
|
|
|
|
|
call psb_geaxpby(done,mlprec_wrk(ilev)%x2l,dzero,mlprec_wrk(ilev)%tx,&
|
|
|
|
|
& baseprecv(ilev)%base_desc,info)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
if (debug) write(0,*) me, 'mlprec_aply done up sweep ',&
|
|
|
|
|
& ilev
|
|
|
|
|
if (info /= 0) then
|
|
|
|
|
call psb_errpush(4001,name,a_err='Error in update')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if (debug_level >= psb_debug_inner_) &
|
|
|
|
|
& write(debug_unit,*) me,' ',trim(name),&
|
|
|
|
|
& ' done up sweep ', ilev
|
|
|
|
|
|
|
|
|
|
enddo
|
|
|
|
|
|
|
|
|
@ -539,10 +558,13 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
!
|
|
|
|
|
call mld_baseprec_aply(done,baseprecv(nlev),mlprec_wrk(nlev)%x2l, &
|
|
|
|
|
& dzero, mlprec_wrk(nlev)%y2l,baseprecv(nlev)%desc_data,'N',work,info)
|
|
|
|
|
if (info /=0) then
|
|
|
|
|
call psb_errpush(4010,name,a_err='baseprec_aply')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
if (debug) write(0,*) me, 'mlprec_aply done prc_apl ',&
|
|
|
|
|
& nlev
|
|
|
|
|
if (debug_level >= psb_debug_inner_) write(debug_unit,*) &
|
|
|
|
|
& me,' ',trim(name), ' done baseprec_aply ', nlev
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
|
! STEP 4
|
|
|
|
@ -551,7 +573,10 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
!
|
|
|
|
|
do ilev=nlev-1, 1, -1
|
|
|
|
|
|
|
|
|
|
if (debug) write(0,*) me, 'mlprec_aply starting down sweep',ilev
|
|
|
|
|
if (debug_level >= psb_debug_inner_) &
|
|
|
|
|
& write(debug_unit,*) me,' ',trim(name),&
|
|
|
|
|
& ' starting down sweep',ilev
|
|
|
|
|
|
|
|
|
|
ismth = baseprecv(ilev+1)%iprcparm(mld_aggr_kind_)
|
|
|
|
|
n_row = psb_cd_get_local_rows(baseprecv(ilev)%base_desc)
|
|
|
|
|
|
|
|
|
@ -562,10 +587,8 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
if (ismth == mld_smooth_prol_) &
|
|
|
|
|
& call psb_halo(mlprec_wrk(ilev+1)%y2l,baseprecv(ilev+1)%desc_data,&
|
|
|
|
|
& info,work=work)
|
|
|
|
|
call psb_csmm(done,baseprecv(ilev+1)%av(mld_sm_pr_),mlprec_wrk(ilev+1)%y2l,&
|
|
|
|
|
& dzero,mlprec_wrk(ilev)%y2l,info)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
|
|
|
|
|
if (info == 0) call psb_csmm(done,baseprecv(ilev+1)%av(mld_sm_pr_),&
|
|
|
|
|
& mlprec_wrk(ilev+1)%y2l, dzero,mlprec_wrk(ilev)%y2l,info)
|
|
|
|
|
else
|
|
|
|
|
!
|
|
|
|
|
! Apply the raw aggregation map (take a shortcut)
|
|
|
|
@ -575,7 +598,10 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
mlprec_wrk(ilev)%y2l(i) = mlprec_wrk(ilev)%y2l(i) + &
|
|
|
|
|
& mlprec_wrk(ilev+1)%y2l(baseprecv(ilev+1)%mlia(i))
|
|
|
|
|
enddo
|
|
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
if (info /=0) then
|
|
|
|
|
call psb_errpush(4001,name,a_err='Error during prolongation')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
@ -584,16 +610,19 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
call psb_spmm(-done,baseprecv(ilev)%base_a,mlprec_wrk(ilev)%y2l,&
|
|
|
|
|
& done,mlprec_wrk(ilev)%tx,baseprecv(ilev)%base_desc,info,work=work)
|
|
|
|
|
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
|
! Apply the base preconditioner
|
|
|
|
|
!
|
|
|
|
|
call mld_baseprec_aply(done,baseprecv(ilev),mlprec_wrk(ilev)%tx,&
|
|
|
|
|
if (info == 0) call mld_baseprec_aply(done,baseprecv(ilev),mlprec_wrk(ilev)%tx,&
|
|
|
|
|
& done,mlprec_wrk(ilev)%y2l,baseprecv(ilev)%base_desc, trans, work,info)
|
|
|
|
|
if (info /=0) then
|
|
|
|
|
call psb_errpush(4001,name,a_err=' spmm/baseprec_aply')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
if (debug) write(0,*) me, 'mlprec_aply done down sweep',ilev
|
|
|
|
|
if (debug_level >= psb_debug_inner_) &
|
|
|
|
|
& write(debug_unit,*) me,' ',trim(name),&
|
|
|
|
|
& ' done down sweep',ilev
|
|
|
|
|
enddo
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
@ -603,8 +632,10 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
!
|
|
|
|
|
call psb_geaxpby(alpha,mlprec_wrk(1)%y2l,beta,y,baseprecv(1)%base_desc,info)
|
|
|
|
|
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
|
|
|
|
|
if (info /=0) then
|
|
|
|
|
call psb_errpush(4001,name,a_err=' Final update')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
case(mld_pre_smooth_)
|
|
|
|
|
|
|
|
|
@ -675,9 +706,10 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
& dzero,mlprec_wrk(1)%y2l,&
|
|
|
|
|
& baseprecv(1)%base_desc,&
|
|
|
|
|
& trans,work,info)
|
|
|
|
|
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
|
|
|
|
|
if (info /=0) then
|
|
|
|
|
call psb_errpush(4010,name,a_err=' baseprec_aply')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
|
! STEP 3
|
|
|
|
@ -688,7 +720,10 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
|
|
|
|
|
call psb_spmm(-done,baseprecv(1)%base_a,mlprec_wrk(1)%y2l,&
|
|
|
|
|
& done,mlprec_wrk(1)%tx,baseprecv(1)%base_desc,info,work=work)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
if (info /=0) then
|
|
|
|
|
call psb_errpush(4001,name,a_err=' fine level residual')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
|
! STEP 4
|
|
|
|
@ -715,7 +750,7 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
|
|
|
|
|
mlprec_wrk(ilev)%x2l(:) = dzero
|
|
|
|
|
mlprec_wrk(ilev)%y2l(:) = dzero
|
|
|
|
|
mlprec_wrk(ilev)%tx(:) = dzero
|
|
|
|
|
mlprec_wrk(ilev)%tx(:) = dzero
|
|
|
|
|
|
|
|
|
|
if (ismth /= mld_no_smooth_) then
|
|
|
|
|
!
|
|
|
|
@ -723,12 +758,8 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
!
|
|
|
|
|
call psb_halo(mlprec_wrk(ilev-1)%tx,baseprecv(ilev-1)%base_desc,&
|
|
|
|
|
& info,work=work)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
|
|
|
|
|
call psb_csmm(done,baseprecv(ilev)%av(mld_sm_pr_t_),mlprec_wrk(ilev-1)%tx,dzero,&
|
|
|
|
|
& mlprec_wrk(ilev)%x2l,info)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
|
|
|
|
|
if (info == 0) call psb_csmm(done,baseprecv(ilev)%av(mld_sm_pr_t_),&
|
|
|
|
|
& mlprec_wrk(ilev-1)%tx,dzero,mlprec_wrk(ilev)%x2l,info)
|
|
|
|
|
else
|
|
|
|
|
!
|
|
|
|
|
! Apply the raw aggregation map transpose (take a shortcut)
|
|
|
|
@ -740,11 +771,18 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
& mlprec_wrk(ilev-1)%tx(i)
|
|
|
|
|
end do
|
|
|
|
|
end if
|
|
|
|
|
if (info /=0) then
|
|
|
|
|
call psb_errpush(4001,name,a_err='Error during restriction')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if (icm ==mld_repl_mat_) then
|
|
|
|
|
call psb_sum(ictxt,mlprec_wrk(ilev)%x2l(1:nr2l))
|
|
|
|
|
else if (icm /= mld_distr_mat_) then
|
|
|
|
|
write(0,*) 'Unknown value for baseprecv(2)%iprcparm(mld_coarse_mat_) ', icm
|
|
|
|
|
info = 4013
|
|
|
|
|
call psb_errpush(info,name,a_err='invalid mld_coarse_mat_',&
|
|
|
|
|
& i_Err=(/icm,0,0,0,0/))
|
|
|
|
|
goto 9999
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
@ -753,18 +791,19 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
call mld_baseprec_aply(done,baseprecv(ilev),mlprec_wrk(ilev)%x2l,&
|
|
|
|
|
& dzero,mlprec_wrk(ilev)%y2l,baseprecv(ilev)%desc_data, 'N',work,info)
|
|
|
|
|
|
|
|
|
|
if(info /= 0) goto 9999
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
|
! Compute the residual (at all levels but the coarsest one)
|
|
|
|
|
!
|
|
|
|
|
if (ilev < nlev) then
|
|
|
|
|
mlprec_wrk(ilev)%tx = mlprec_wrk(ilev)%x2l
|
|
|
|
|
call psb_spmm(-done,baseprecv(ilev)%base_a,mlprec_wrk(ilev)%y2l,&
|
|
|
|
|
& done,mlprec_wrk(ilev)%tx,baseprecv(ilev)%base_desc,info,work=work)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
if (info == 0) call psb_spmm(-done,baseprecv(ilev)%base_a,&
|
|
|
|
|
& mlprec_wrk(ilev)%y2l,done,mlprec_wrk(ilev)%tx,&
|
|
|
|
|
& baseprecv(ilev)%base_desc,info,work=work)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
if (info /=0) then
|
|
|
|
|
call psb_errpush(4001,name,a_err='Error on up sweep residual')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
enddo
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
@ -784,10 +823,8 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
if (ismth == mld_smooth_prol_) &
|
|
|
|
|
& call psb_halo(mlprec_wrk(ilev+1)%y2l,&
|
|
|
|
|
& baseprecv(ilev+1)%desc_data,info,work=work)
|
|
|
|
|
call psb_csmm(done,baseprecv(ilev+1)%av(mld_sm_pr_),mlprec_wrk(ilev+1)%y2l,&
|
|
|
|
|
& done,mlprec_wrk(ilev)%y2l,info)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
|
|
|
|
|
if (info == 0) call psb_csmm(done,baseprecv(ilev+1)%av(mld_sm_pr_),&
|
|
|
|
|
& mlprec_wrk(ilev+1)%y2l,done,mlprec_wrk(ilev)%y2l,info)
|
|
|
|
|
else
|
|
|
|
|
!
|
|
|
|
|
! Apply the raw aggregation map (take a shortcut)
|
|
|
|
@ -796,9 +833,11 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
mlprec_wrk(ilev)%y2l(i) = mlprec_wrk(ilev)%y2l(i) + &
|
|
|
|
|
& mlprec_wrk(ilev+1)%y2l(baseprecv(ilev+1)%mlia(i))
|
|
|
|
|
enddo
|
|
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if (info /=0) then
|
|
|
|
|
call psb_errpush(4001,name,a_err='Error during prolongation')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
enddo
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
@ -808,8 +847,11 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
!
|
|
|
|
|
call psb_geaxpby(alpha,mlprec_wrk(1)%y2l,beta,y,&
|
|
|
|
|
& baseprecv(1)%base_desc,info)
|
|
|
|
|
if (info /=0) then
|
|
|
|
|
call psb_errpush(4001,name,a_err='Error on final update')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case(mld_twoside_smooth_)
|
|
|
|
@ -891,18 +933,18 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
& dzero,mlprec_wrk(1)%y2l,&
|
|
|
|
|
& baseprecv(1)%base_desc,&
|
|
|
|
|
& trans,work,info)
|
|
|
|
|
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
|
! STEP 3
|
|
|
|
|
!
|
|
|
|
|
! Compute the residual at the finest level
|
|
|
|
|
!
|
|
|
|
|
mlprec_wrk(1)%ty = mlprec_wrk(1)%x2l
|
|
|
|
|
call psb_spmm(-done,baseprecv(1)%base_a,mlprec_wrk(1)%y2l,&
|
|
|
|
|
if (info == 0) call psb_spmm(-done,baseprecv(1)%base_a,mlprec_wrk(1)%y2l,&
|
|
|
|
|
& done,mlprec_wrk(1)%ty,baseprecv(1)%base_desc,info,work=work)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
if (info /=0) then
|
|
|
|
|
call psb_errpush(4010,name,a_err='Fine level baseprec/residual')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
|
! STEP 4
|
|
|
|
@ -938,11 +980,8 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
!
|
|
|
|
|
call psb_halo(mlprec_wrk(ilev-1)%ty,baseprecv(ilev-1)%base_desc,&
|
|
|
|
|
& info,work=work)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
call psb_csmm(done,baseprecv(ilev)%av(mld_sm_pr_t_),mlprec_wrk(ilev-1)%ty,dzero,&
|
|
|
|
|
& mlprec_wrk(ilev)%x2l,info)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
|
|
|
|
|
if (info == 0) call psb_csmm(done,baseprecv(ilev)%av(mld_sm_pr_t_),&
|
|
|
|
|
& mlprec_wrk(ilev-1)%ty,dzero,mlprec_wrk(ilev)%x2l,info)
|
|
|
|
|
else
|
|
|
|
|
!
|
|
|
|
|
! Apply the raw aggregation map transpose (take a shortcut)
|
|
|
|
@ -954,34 +993,41 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
& mlprec_wrk(ilev-1)%ty(i)
|
|
|
|
|
end do
|
|
|
|
|
end if
|
|
|
|
|
if (info /=0) then
|
|
|
|
|
call psb_errpush(4001,name,a_err='Error during restriction')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
if (icm == mld_repl_mat_) then
|
|
|
|
|
call psb_sum(ictxt,mlprec_wrk(ilev)%x2l(1:nr2l))
|
|
|
|
|
else if (icm /= mld_distr_mat_) then
|
|
|
|
|
write(0,*) 'Unknown value for baseprecv(2)%iprcparm(mld_coarse_mat_) ', icm
|
|
|
|
|
info = 4013
|
|
|
|
|
call psb_errpush(info,name,a_err='invalid mld_coarse_mat_',&
|
|
|
|
|
& i_Err=(/icm,0,0,0,0/))
|
|
|
|
|
goto 9999
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
call psb_geaxpby(done,mlprec_wrk(ilev)%x2l,dzero,mlprec_wrk(ilev)%tx,&
|
|
|
|
|
& baseprecv(ilev)%base_desc,info)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
|
! Apply the base preconditioner
|
|
|
|
|
!
|
|
|
|
|
call mld_baseprec_aply(done,baseprecv(ilev),mlprec_wrk(ilev)%x2l,&
|
|
|
|
|
& dzero,mlprec_wrk(ilev)%y2l,baseprecv(ilev)%desc_data, 'N',work,info)
|
|
|
|
|
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
|
|
|
|
|
if (info == 0) call mld_baseprec_aply(done,baseprecv(ilev),&
|
|
|
|
|
& mlprec_wrk(ilev)%x2l,dzero,mlprec_wrk(ilev)%y2l,&
|
|
|
|
|
& baseprecv(ilev)%desc_data, 'N',work,info)
|
|
|
|
|
!
|
|
|
|
|
! Compute the residual (at all levels but the coarsest one)
|
|
|
|
|
!
|
|
|
|
|
if(ilev < nlev) then
|
|
|
|
|
mlprec_wrk(ilev)%ty = mlprec_wrk(ilev)%x2l
|
|
|
|
|
call psb_spmm(-done,baseprecv(ilev)%base_a,mlprec_wrk(ilev)%y2l,&
|
|
|
|
|
& done,mlprec_wrk(ilev)%ty,baseprecv(ilev)%base_desc,info,work=work)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
if (info == 0) call psb_spmm(-done,baseprecv(ilev)%base_a,&
|
|
|
|
|
& mlprec_wrk(ilev)%y2l,done,mlprec_wrk(ilev)%ty,&
|
|
|
|
|
& baseprecv(ilev)%base_desc,info,work=work)
|
|
|
|
|
endif
|
|
|
|
|
if (info /=0) then
|
|
|
|
|
call psb_errpush(4001,name,a_err='baseprec_aply/residual')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
enddo
|
|
|
|
|
|
|
|
|
@ -1002,10 +1048,8 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
if (ismth == mld_smooth_prol_) &
|
|
|
|
|
& call psb_halo(mlprec_wrk(ilev+1)%y2l,baseprecv(ilev+1)%desc_data,&
|
|
|
|
|
& info,work=work)
|
|
|
|
|
call psb_csmm(done,baseprecv(ilev+1)%av(mld_sm_pr_),mlprec_wrk(ilev+1)%y2l,&
|
|
|
|
|
& done,mlprec_wrk(ilev)%y2l,info)
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
|
|
|
|
|
if (info == 0) call psb_csmm(done,baseprecv(ilev+1)%av(mld_sm_pr_),&
|
|
|
|
|
& mlprec_wrk(ilev+1)%y2l, done,mlprec_wrk(ilev)%y2l,info)
|
|
|
|
|
else
|
|
|
|
|
!
|
|
|
|
|
! Apply the raw aggregation map (take a shortcut)
|
|
|
|
@ -1014,7 +1058,10 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
mlprec_wrk(ilev)%y2l(i) = mlprec_wrk(ilev)%y2l(i) + &
|
|
|
|
|
& mlprec_wrk(ilev+1)%y2l(baseprecv(ilev+1)%mlia(i))
|
|
|
|
|
enddo
|
|
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
if (info /=0 ) then
|
|
|
|
|
call psb_errpush(4001,name,a_err='Error during restriction')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
@ -1022,17 +1069,15 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
!
|
|
|
|
|
call psb_spmm(-done,baseprecv(ilev)%base_a,mlprec_wrk(ilev)%y2l,&
|
|
|
|
|
& done,mlprec_wrk(ilev)%tx,baseprecv(ilev)%base_desc,info,work=work)
|
|
|
|
|
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
|
! Apply the base preconditioner
|
|
|
|
|
!
|
|
|
|
|
call mld_baseprec_aply(done,baseprecv(ilev),mlprec_wrk(ilev)%tx,&
|
|
|
|
|
if (info == 0) call mld_baseprec_aply(done,baseprecv(ilev),mlprec_wrk(ilev)%tx,&
|
|
|
|
|
& done,mlprec_wrk(ilev)%y2l,baseprecv(ilev)%base_desc, trans, work,info)
|
|
|
|
|
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
|
|
|
|
|
if (info /= 0) then
|
|
|
|
|
call psb_errpush(4001,name,a_err='Error: residual/baseprec_aply')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
enddo
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
@ -1043,30 +1088,37 @@ subroutine mld_dmlprec_aply(alpha,baseprecv,x,beta,y,desc_data,trans,work,info)
|
|
|
|
|
call psb_geaxpby(alpha,mlprec_wrk(1)%y2l,beta,y,&
|
|
|
|
|
& baseprecv(1)%base_desc,info)
|
|
|
|
|
|
|
|
|
|
if(info /=0) goto 9999
|
|
|
|
|
if (info /= 0) then
|
|
|
|
|
call psb_errpush(4001,name,a_err='Error final update')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
case default
|
|
|
|
|
|
|
|
|
|
call psb_errpush(4013,name,a_err='wrong smooth_pos',&
|
|
|
|
|
info = 4013
|
|
|
|
|
call psb_errpush(info,name,a_err='invalid smooth_pos',&
|
|
|
|
|
& i_Err=(/baseprecv(2)%iprcparm(mld_smooth_pos_),0,0,0,0/))
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
|
|
case default
|
|
|
|
|
call psb_errpush(4013,name,a_err='wrong mltype',&
|
|
|
|
|
info = 4013
|
|
|
|
|
call psb_errpush(info,name,a_err='invalid mltype',&
|
|
|
|
|
& i_Err=(/baseprecv(2)%iprcparm(mld_ml_type_),0,0,0,0/))
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
|
|
deallocate(mlprec_wrk)
|
|
|
|
|
deallocate(mlprec_wrk,stat=info)
|
|
|
|
|
if (info /= 0) then
|
|
|
|
|
call psb_errpush(4000,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
call psb_erractionrestore(err_act)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
9999 continue
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
call psb_erractionrestore(err_act)
|
|
|
|
|
if (err_act.eq.psb_act_abort_) then
|
|
|
|
|
call psb_error()
|
|
|
|
|