Skip to content

Commit

Permalink
Fix handling of diagonal block for JAC smoother build
Browse files Browse the repository at this point in the history
  • Loading branch information
sfilippone committed May 6, 2020
1 parent 60c4f29 commit 9952bc6
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 48 deletions.
24 changes: 12 additions & 12 deletions mlprec/impl/smoother/mld_c_jac_smoother_bld.f90
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ subroutine mld_c_jac_smoother_bld(a,desc_a,sm,info,amold,vmold,imold)
class(psb_c_base_vect_type), intent(in), optional :: vmold
class(psb_i_base_vect_type), intent(in), optional :: imold
! Local variables
type(psb_cspmat_type) :: tmpa
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota, nzeros
complex(psb_spk_), pointer :: ww(:), aux(:), tx(:),ty(:)
type(psb_c_coo_sparse_mat) :: tmpcoo
integer(psb_ipk_) :: ictxt,np,me,i, err_act, debug_unit, debug_level
character(len=20) :: name='c_jac_smoother_bld', ch_err

Expand All @@ -76,17 +75,22 @@ subroutine mld_c_jac_smoother_bld(a,desc_a,sm,info,amold,vmold,imold)
call sm%nd%free()
sm%pa => a
sm%nnz_nd_tot = nztota
call psb_sum(ictxt,sm%nnz_nd_tot)
call sm%sv%build(a,desc_a,info,amold=amold,vmold=vmold)

class default
if (smsv%is_global()) then
! Do not put anything into SM%ND since the solver
! is acting globally.
call sm%nd%free()
sm%nnz_nd_tot = 0
call psb_sum(ictxt,sm%nnz_nd_tot)
call sm%sv%build(a,desc_a,info,amold=amold,vmold=vmold)
else
call a%csclip(sm%nd,info,&
& jmin=nrow_a+1,rscale=.false.,cscale=.false.)
if (info == psb_success_) then
if (present(amold)) then
if (info == psb_success_) then
if (present(amold)) then
call sm%nd%cscnv(info,&
& mold=amold,dupl=psb_dupl_add_)
else
Expand All @@ -95,22 +99,18 @@ subroutine mld_c_jac_smoother_bld(a,desc_a,sm,info,amold,vmold,imold)
endif
end if
sm%nnz_nd_tot = sm%nd%get_nzeros()
call psb_sum(ictxt,sm%nnz_nd_tot)
call a%csclip(tmpa,info,&
& jmax=nrow_a,rscale=.false.,cscale=.false.)
call sm%sv%build(tmpa,desc_a,info,amold=amold,vmold=vmold)
end if
end select
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,&
& a_err='clip & psb_spcnv csr 4')
goto 9999
end if
call psb_sum(ictxt,sm%nnz_nd_tot)


call sm%sv%build(a,desc_a,info,amold=amold,vmold=vmold)
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,&
& a_err='solver build')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),' end'

Expand Down
24 changes: 12 additions & 12 deletions mlprec/impl/smoother/mld_d_jac_smoother_bld.f90
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ subroutine mld_d_jac_smoother_bld(a,desc_a,sm,info,amold,vmold,imold)
class(psb_d_base_vect_type), intent(in), optional :: vmold
class(psb_i_base_vect_type), intent(in), optional :: imold
! Local variables
type(psb_dspmat_type) :: tmpa
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota, nzeros
real(psb_dpk_), pointer :: ww(:), aux(:), tx(:),ty(:)
type(psb_d_coo_sparse_mat) :: tmpcoo
integer(psb_ipk_) :: ictxt,np,me,i, err_act, debug_unit, debug_level
character(len=20) :: name='d_jac_smoother_bld', ch_err

Expand All @@ -76,17 +75,22 @@ subroutine mld_d_jac_smoother_bld(a,desc_a,sm,info,amold,vmold,imold)
call sm%nd%free()
sm%pa => a
sm%nnz_nd_tot = nztota
call psb_sum(ictxt,sm%nnz_nd_tot)
call sm%sv%build(a,desc_a,info,amold=amold,vmold=vmold)

class default
if (smsv%is_global()) then
! Do not put anything into SM%ND since the solver
! is acting globally.
call sm%nd%free()
sm%nnz_nd_tot = 0
call psb_sum(ictxt,sm%nnz_nd_tot)
call sm%sv%build(a,desc_a,info,amold=amold,vmold=vmold)
else
call a%csclip(sm%nd,info,&
& jmin=nrow_a+1,rscale=.false.,cscale=.false.)
if (info == psb_success_) then
if (present(amold)) then
if (info == psb_success_) then
if (present(amold)) then
call sm%nd%cscnv(info,&
& mold=amold,dupl=psb_dupl_add_)
else
Expand All @@ -95,22 +99,18 @@ subroutine mld_d_jac_smoother_bld(a,desc_a,sm,info,amold,vmold,imold)
endif
end if
sm%nnz_nd_tot = sm%nd%get_nzeros()
call psb_sum(ictxt,sm%nnz_nd_tot)
call a%csclip(tmpa,info,&
& jmax=nrow_a,rscale=.false.,cscale=.false.)
call sm%sv%build(tmpa,desc_a,info,amold=amold,vmold=vmold)
end if
end select
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,&
& a_err='clip & psb_spcnv csr 4')
goto 9999
end if
call psb_sum(ictxt,sm%nnz_nd_tot)


call sm%sv%build(a,desc_a,info,amold=amold,vmold=vmold)
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,&
& a_err='solver build')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),' end'

Expand Down
24 changes: 12 additions & 12 deletions mlprec/impl/smoother/mld_s_jac_smoother_bld.f90
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ subroutine mld_s_jac_smoother_bld(a,desc_a,sm,info,amold,vmold,imold)
class(psb_s_base_vect_type), intent(in), optional :: vmold
class(psb_i_base_vect_type), intent(in), optional :: imold
! Local variables
type(psb_sspmat_type) :: tmpa
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota, nzeros
real(psb_spk_), pointer :: ww(:), aux(:), tx(:),ty(:)
type(psb_s_coo_sparse_mat) :: tmpcoo
integer(psb_ipk_) :: ictxt,np,me,i, err_act, debug_unit, debug_level
character(len=20) :: name='s_jac_smoother_bld', ch_err

Expand All @@ -76,17 +75,22 @@ subroutine mld_s_jac_smoother_bld(a,desc_a,sm,info,amold,vmold,imold)
call sm%nd%free()
sm%pa => a
sm%nnz_nd_tot = nztota
call psb_sum(ictxt,sm%nnz_nd_tot)
call sm%sv%build(a,desc_a,info,amold=amold,vmold=vmold)

class default
if (smsv%is_global()) then
! Do not put anything into SM%ND since the solver
! is acting globally.
call sm%nd%free()
sm%nnz_nd_tot = 0
call psb_sum(ictxt,sm%nnz_nd_tot)
call sm%sv%build(a,desc_a,info,amold=amold,vmold=vmold)
else
call a%csclip(sm%nd,info,&
& jmin=nrow_a+1,rscale=.false.,cscale=.false.)
if (info == psb_success_) then
if (present(amold)) then
if (info == psb_success_) then
if (present(amold)) then
call sm%nd%cscnv(info,&
& mold=amold,dupl=psb_dupl_add_)
else
Expand All @@ -95,22 +99,18 @@ subroutine mld_s_jac_smoother_bld(a,desc_a,sm,info,amold,vmold,imold)
endif
end if
sm%nnz_nd_tot = sm%nd%get_nzeros()
call psb_sum(ictxt,sm%nnz_nd_tot)
call a%csclip(tmpa,info,&
& jmax=nrow_a,rscale=.false.,cscale=.false.)
call sm%sv%build(tmpa,desc_a,info,amold=amold,vmold=vmold)
end if
end select
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,&
& a_err='clip & psb_spcnv csr 4')
goto 9999
end if
call psb_sum(ictxt,sm%nnz_nd_tot)


call sm%sv%build(a,desc_a,info,amold=amold,vmold=vmold)
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,&
& a_err='solver build')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),' end'

Expand Down
24 changes: 12 additions & 12 deletions mlprec/impl/smoother/mld_z_jac_smoother_bld.f90
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ subroutine mld_z_jac_smoother_bld(a,desc_a,sm,info,amold,vmold,imold)
class(psb_z_base_vect_type), intent(in), optional :: vmold
class(psb_i_base_vect_type), intent(in), optional :: imold
! Local variables
type(psb_zspmat_type) :: tmpa
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota, nzeros
complex(psb_dpk_), pointer :: ww(:), aux(:), tx(:),ty(:)
type(psb_z_coo_sparse_mat) :: tmpcoo
integer(psb_ipk_) :: ictxt,np,me,i, err_act, debug_unit, debug_level
character(len=20) :: name='z_jac_smoother_bld', ch_err

Expand All @@ -76,17 +75,22 @@ subroutine mld_z_jac_smoother_bld(a,desc_a,sm,info,amold,vmold,imold)
call sm%nd%free()
sm%pa => a
sm%nnz_nd_tot = nztota
call psb_sum(ictxt,sm%nnz_nd_tot)
call sm%sv%build(a,desc_a,info,amold=amold,vmold=vmold)

class default
if (smsv%is_global()) then
! Do not put anything into SM%ND since the solver
! is acting globally.
call sm%nd%free()
sm%nnz_nd_tot = 0
call psb_sum(ictxt,sm%nnz_nd_tot)
call sm%sv%build(a,desc_a,info,amold=amold,vmold=vmold)
else
call a%csclip(sm%nd,info,&
& jmin=nrow_a+1,rscale=.false.,cscale=.false.)
if (info == psb_success_) then
if (present(amold)) then
if (info == psb_success_) then
if (present(amold)) then
call sm%nd%cscnv(info,&
& mold=amold,dupl=psb_dupl_add_)
else
Expand All @@ -95,22 +99,18 @@ subroutine mld_z_jac_smoother_bld(a,desc_a,sm,info,amold,vmold,imold)
endif
end if
sm%nnz_nd_tot = sm%nd%get_nzeros()
call psb_sum(ictxt,sm%nnz_nd_tot)
call a%csclip(tmpa,info,&
& jmax=nrow_a,rscale=.false.,cscale=.false.)
call sm%sv%build(tmpa,desc_a,info,amold=amold,vmold=vmold)
end if
end select
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,&
& a_err='clip & psb_spcnv csr 4')
goto 9999
end if
call psb_sum(ictxt,sm%nnz_nd_tot)


call sm%sv%build(a,desc_a,info,amold=amold,vmold=vmold)
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,&
& a_err='solver build')
goto 9999
end if
if (debug_level >= psb_debug_outer_) &
& write(debug_unit,*) me,' ',trim(name),' end'

Expand Down

0 comments on commit 9952bc6

Please sign in to comment.