|
|
|
@ -82,7 +82,7 @@ subroutine amg_c_hierarchy_bld(a,desc_a,prec,info)
|
|
|
|
|
integer(psb_ipk_) :: me,np
|
|
|
|
|
integer(psb_ipk_) :: err,i,k, err_act, iszv, newsz,&
|
|
|
|
|
& nplevs, mxplevs
|
|
|
|
|
integer(psb_lpk_) :: iaggsize, casize
|
|
|
|
|
integer(psb_lpk_) :: iaggsize, casize, mncsize, mncszpp
|
|
|
|
|
real(psb_spk_) :: mnaggratio, sizeratio, athresh, aomega
|
|
|
|
|
class(amg_c_base_smoother_type), allocatable :: coarse_sm, med_sm, &
|
|
|
|
|
& med_sm2, coarse_sm2
|
|
|
|
@ -132,17 +132,24 @@ subroutine amg_c_hierarchy_bld(a,desc_a,prec,info)
|
|
|
|
|
newsz = -1
|
|
|
|
|
mxplevs = prec%ag_data%max_levs
|
|
|
|
|
mnaggratio = prec%ag_data%min_cr_ratio
|
|
|
|
|
casize = prec%ag_data%min_coarse_size
|
|
|
|
|
mncsize = prec%ag_data%min_coarse_size
|
|
|
|
|
mncszpp = prec%ag_data%min_coarse_size_per_process
|
|
|
|
|
iszv = size(prec%precv)
|
|
|
|
|
call psb_bcast(ctxt,iszv)
|
|
|
|
|
call psb_bcast(ctxt,casize)
|
|
|
|
|
call psb_bcast(ctxt,mncsize)
|
|
|
|
|
call psb_bcast(ctxt,mncszpp)
|
|
|
|
|
call psb_bcast(ctxt,mxplevs)
|
|
|
|
|
call psb_bcast(ctxt,mnaggratio)
|
|
|
|
|
if (casize /= prec%ag_data%min_coarse_size) then
|
|
|
|
|
if (mncsize /= prec%ag_data%min_coarse_size) then
|
|
|
|
|
info=psb_err_internal_error_
|
|
|
|
|
call psb_errpush(info,name,a_err='Inconsistent min_coarse_size')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
if (mncszpp /= prec%ag_data%min_coarse_size_per_process) then
|
|
|
|
|
info=psb_err_internal_error_
|
|
|
|
|
call psb_errpush(info,name,a_err='Inconsistent min_coarse_size_per_process')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
if (mxplevs /= prec%ag_data%max_levs) then
|
|
|
|
|
info=psb_err_internal_error_
|
|
|
|
|
call psb_errpush(info,name,a_err='Inconsistent max_levs')
|
|
|
|
@ -192,26 +199,23 @@ subroutine amg_c_hierarchy_bld(a,desc_a,prec,info)
|
|
|
|
|
! coarse size is hit, or the gain falls below the min_cr_ratio
|
|
|
|
|
! threshold.
|
|
|
|
|
!
|
|
|
|
|
|
|
|
|
|
if (casize < 0) then
|
|
|
|
|
!
|
|
|
|
|
! Default to the cubic root of the size at base level.
|
|
|
|
|
!
|
|
|
|
|
casize = desc_a%get_global_rows()
|
|
|
|
|
casize = int((sone*casize)**(sone/(sone*3)),psb_lpk_)
|
|
|
|
|
casize = max(casize,lone)
|
|
|
|
|
casize = casize*40_psb_lpk_
|
|
|
|
|
call psb_bcast(ctxt,casize)
|
|
|
|
|
if (casize > huge(prec%ag_data%min_coarse_size)) then
|
|
|
|
|
!
|
|
|
|
|
! computed coarse size does not fit in IPK_.
|
|
|
|
|
! This is very unlikely, but make sure to put a positive number
|
|
|
|
|
!
|
|
|
|
|
prec%ag_data%min_coarse_size = huge(prec%ag_data%min_coarse_size)
|
|
|
|
|
if ((mncszpp < 0).and.(mncsize<0)) then
|
|
|
|
|
mncszpp = 200
|
|
|
|
|
prec%ag_data%min_coarse_size_per_process = mncszpp
|
|
|
|
|
end if
|
|
|
|
|
if (mncszpp > 0) then
|
|
|
|
|
casize = mncszpp*np
|
|
|
|
|
if (casize > huge(ione)) casize = huge(ione)
|
|
|
|
|
else
|
|
|
|
|
prec%ag_data%min_coarse_size = casize
|
|
|
|
|
if (mncsize < np) then
|
|
|
|
|
if (me == 0) write(0,*) &
|
|
|
|
|
& 'Warning: resetting coarse size to NP (1 variable per process)'
|
|
|
|
|
mncsize = np
|
|
|
|
|
end if
|
|
|
|
|
casize = mncsize
|
|
|
|
|
end if
|
|
|
|
|
prec%ag_data%target_coarse_size = casize
|
|
|
|
|
|
|
|
|
|
nplevs = max(itwo,mxplevs)
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
|