|
|
|
@ -41,8 +41,8 @@
|
|
|
|
|
! nz - integer. The number of points to insert.
|
|
|
|
|
! ia(:) - integer The row indices of the coefficients.
|
|
|
|
|
! ja(:) - integer The column indices of the coefficients.
|
|
|
|
|
! val(:) - real The values of the coefficients to be inserted.
|
|
|
|
|
! a - type(psb_sspmat_type). The sparse destination matrix.
|
|
|
|
|
! val(:) - real The values of the coefficients to be inserted.
|
|
|
|
|
! a - type(psb_dspmat_type). The sparse destination matrix.
|
|
|
|
|
! desc_a - type(psb_desc_type). The communication descriptor.
|
|
|
|
|
! info - integer. Error code
|
|
|
|
|
! rebuild - logical Allows to reopen a matrix under
|
|
|
|
@ -50,15 +50,16 @@
|
|
|
|
|
!
|
|
|
|
|
subroutine psb_sspins(nz,ia,ja,val,a,desc_a,info,rebuild)
|
|
|
|
|
use psb_base_mod, psb_protect_name => psb_sspins
|
|
|
|
|
use psi_mod
|
|
|
|
|
implicit none
|
|
|
|
|
|
|
|
|
|
!....parameters...
|
|
|
|
|
type(psb_desc_type), intent(inout) :: desc_a
|
|
|
|
|
type(psb_desc_type), intent(inout) :: desc_a
|
|
|
|
|
type(psb_sspmat_type), intent(inout) :: a
|
|
|
|
|
integer(psb_ipk_), intent(in) :: nz,ia(:),ja(:)
|
|
|
|
|
integer(psb_ipk_), intent(in) :: nz,ia(:),ja(:)
|
|
|
|
|
real(psb_spk_), intent(in) :: val(:)
|
|
|
|
|
integer(psb_ipk_), intent(out) :: info
|
|
|
|
|
logical, intent(in), optional :: rebuild
|
|
|
|
|
integer(psb_ipk_), intent(out) :: info
|
|
|
|
|
logical, intent(in), optional :: rebuild
|
|
|
|
|
!locals.....
|
|
|
|
|
|
|
|
|
|
integer(psb_ipk_) :: nrow, err_act, ncol, spstate
|
|
|
|
@ -67,23 +68,22 @@ subroutine psb_sspins(nz,ia,ja,val,a,desc_a,info,rebuild)
|
|
|
|
|
integer(psb_ipk_), parameter :: relocsz=200
|
|
|
|
|
logical :: rebuild_
|
|
|
|
|
integer(psb_ipk_), allocatable :: ila(:),jla(:)
|
|
|
|
|
character(len=20) :: name, ch_err
|
|
|
|
|
integer(psb_ipk_) :: ierr(5)
|
|
|
|
|
character(len=20) :: name
|
|
|
|
|
|
|
|
|
|
info = psb_success_
|
|
|
|
|
name = 'psb_sspins'
|
|
|
|
|
call psb_erractionsave(err_act)
|
|
|
|
|
|
|
|
|
|
if (.not.desc_a%is_ok()) then
|
|
|
|
|
info = psb_err_invalid_cd_state_
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
ictxt = desc_a%get_context()
|
|
|
|
|
|
|
|
|
|
call psb_info(ictxt, me, np)
|
|
|
|
|
|
|
|
|
|
if (.not.psb_is_ok_desc(desc_a)) then
|
|
|
|
|
info = psb_err_invalid_cd_state_
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
if (nz < 0) then
|
|
|
|
|
info = 1111
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
@ -117,28 +117,27 @@ subroutine psb_sspins(nz,ia,ja,val,a,desc_a,info,rebuild)
|
|
|
|
|
|
|
|
|
|
allocate(ila(nz),jla(nz),stat=info)
|
|
|
|
|
if (info /= psb_success_) then
|
|
|
|
|
ch_err='allocate'
|
|
|
|
|
ierr(1) = info
|
|
|
|
|
call psb_errpush(psb_err_from_subroutine_ai_,name,&
|
|
|
|
|
& a_err=ch_err,i_err=(/info,0,0,0,0/))
|
|
|
|
|
& a_err='allocate',i_err=ierr)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
call psb_cdins(nz,ia,ja,desc_a,info,ila=ila,jla=jla)
|
|
|
|
|
|
|
|
|
|
if (info /= psb_success_) then
|
|
|
|
|
ch_err='psb_cdins'
|
|
|
|
|
ierr(1) = info
|
|
|
|
|
call psb_errpush(psb_err_from_subroutine_ai_,name,&
|
|
|
|
|
& a_err=ch_err,i_err=(/info,0,0,0,0/))
|
|
|
|
|
& a_err='psb_cdins',i_err=ierr)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
nrow = desc_a%get_local_rows()
|
|
|
|
|
ncol = desc_a%get_local_cols()
|
|
|
|
|
|
|
|
|
|
if (a%is_bld()) then
|
|
|
|
|
call a%csput(nz,ila,jla,val,1,nrow,1,ncol,info)
|
|
|
|
|
call a%csput(nz,ila,jla,val,ione,nrow,ione,ncol,info)
|
|
|
|
|
if (info /= psb_success_) then
|
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
|
ch_err='psb_coins'
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
call psb_errpush(info,name,a_err='a%csput')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
else
|
|
|
|
@ -152,9 +151,9 @@ subroutine psb_sspins(nz,ia,ja,val,a,desc_a,info,rebuild)
|
|
|
|
|
|
|
|
|
|
allocate(ila(nz),jla(nz),stat=info)
|
|
|
|
|
if (info /= psb_success_) then
|
|
|
|
|
ch_err='allocate'
|
|
|
|
|
ierr(1) = info
|
|
|
|
|
call psb_errpush(psb_err_from_subroutine_ai_,name,&
|
|
|
|
|
& a_err=ch_err,i_err=(/info,0,0,0,0/))
|
|
|
|
|
& a_err='allocate',i_err=ierr)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
@ -165,11 +164,10 @@ subroutine psb_sspins(nz,ia,ja,val,a,desc_a,info,rebuild)
|
|
|
|
|
nrow = desc_a%get_local_rows()
|
|
|
|
|
ncol = desc_a%get_local_cols()
|
|
|
|
|
|
|
|
|
|
call a%csput(nz,ila,jla,val,1,nrow,1,ncol,info)
|
|
|
|
|
call a%csput(nz,ila,jla,val,ione,nrow,ione,ncol,info)
|
|
|
|
|
if (info /= psb_success_) then
|
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
|
ch_err='psb_coins'
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
call psb_errpush(info,name,a_err='a%csput')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
@ -195,6 +193,7 @@ end subroutine psb_sspins
|
|
|
|
|
|
|
|
|
|
subroutine psb_sspins_2desc(nz,ia,ja,val,a,desc_ar,desc_ac,info)
|
|
|
|
|
use psb_base_mod, psb_protect_name => psb_sspins_2desc
|
|
|
|
|
use psi_mod
|
|
|
|
|
implicit none
|
|
|
|
|
|
|
|
|
|
!....parameters...
|
|
|
|
@ -202,7 +201,7 @@ subroutine psb_sspins_2desc(nz,ia,ja,val,a,desc_ar,desc_ac,info)
|
|
|
|
|
type(psb_desc_type), intent(inout) :: desc_ac
|
|
|
|
|
type(psb_sspmat_type), intent(inout) :: a
|
|
|
|
|
integer(psb_ipk_), intent(in) :: nz,ia(:),ja(:)
|
|
|
|
|
real(kind=psb_spk_), intent(in) :: val(:)
|
|
|
|
|
real(psb_spk_), intent(in) :: val(:)
|
|
|
|
|
integer(psb_ipk_), intent(out) :: info
|
|
|
|
|
!locals.....
|
|
|
|
|
|
|
|
|
@ -211,27 +210,26 @@ subroutine psb_sspins_2desc(nz,ia,ja,val,a,desc_ar,desc_ac,info)
|
|
|
|
|
logical, parameter :: debug=.false.
|
|
|
|
|
integer(psb_ipk_), parameter :: relocsz=200
|
|
|
|
|
integer(psb_ipk_), allocatable :: ila(:),jla(:)
|
|
|
|
|
character(len=20) :: name, ch_err
|
|
|
|
|
integer(psb_ipk_) :: ierr(5)
|
|
|
|
|
character(len=20) :: name
|
|
|
|
|
|
|
|
|
|
info = psb_success_
|
|
|
|
|
name = 'psb_sspins'
|
|
|
|
|
if (psb_errstatus_fatal()) return
|
|
|
|
|
name = 'psb_dspins'
|
|
|
|
|
call psb_erractionsave(err_act)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ictxt = desc_ar%get_context()
|
|
|
|
|
|
|
|
|
|
call psb_info(ictxt, me, np)
|
|
|
|
|
|
|
|
|
|
if (.not.psb_is_ok_desc(desc_ar)) then
|
|
|
|
|
info = psb_err_invalid_cd_state_
|
|
|
|
|
if (.not.desc_ar%is_ok()) then
|
|
|
|
|
info = psb_err_invalid_cd_state_
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
endif
|
|
|
|
|
if (.not.psb_is_ok_desc(desc_ac)) then
|
|
|
|
|
end if
|
|
|
|
|
if (.not.desc_ac%is_ok()) then
|
|
|
|
|
info = psb_err_invalid_cd_state_
|
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
|
goto 9999
|
|
|
|
|
endif
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
ictxt = desc_ar%get_context()
|
|
|
|
|
call psb_info(ictxt, me, np)
|
|
|
|
|
|
|
|
|
|
if (nz < 0) then
|
|
|
|
|
info = 1111
|
|
|
|
@ -256,13 +254,13 @@ subroutine psb_sspins_2desc(nz,ia,ja,val,a,desc_ar,desc_ac,info)
|
|
|
|
|
end if
|
|
|
|
|
if (nz == 0) return
|
|
|
|
|
|
|
|
|
|
if (psb_is_bld_desc(desc_ac)) then
|
|
|
|
|
if (desc_ac%is_bld()) then
|
|
|
|
|
|
|
|
|
|
allocate(ila(nz),jla(nz),stat=info)
|
|
|
|
|
if (info /= psb_success_) then
|
|
|
|
|
ch_err='allocate'
|
|
|
|
|
ierr(1) = info
|
|
|
|
|
call psb_errpush(psb_err_from_subroutine_ai_,name,&
|
|
|
|
|
& a_err=ch_err,i_err=(/info,0,0,0,0/))
|
|
|
|
|
& a_err='allocate',i_err=ierr)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
ila(1:nz) = ia(1:nz)
|
|
|
|
@ -271,25 +269,24 @@ subroutine psb_sspins_2desc(nz,ia,ja,val,a,desc_ar,desc_ac,info)
|
|
|
|
|
|
|
|
|
|
call psb_cdins(nz,ja,desc_ac,info,jla=jla, mask=(ila(1:nz)>0))
|
|
|
|
|
|
|
|
|
|
if (info /= psb_success_) then
|
|
|
|
|
ch_err='psb_cdins'
|
|
|
|
|
if (psb_errstatus_fatal()) then
|
|
|
|
|
ierr(1) = info
|
|
|
|
|
call psb_errpush(psb_err_from_subroutine_ai_,name,&
|
|
|
|
|
& a_err=ch_err,i_err=(/info,0,0,0,0/))
|
|
|
|
|
& a_err='psb_cdins',i_err=ierr)
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
nrow = desc_ar%get_local_rows()
|
|
|
|
|
ncol = desc_ac%get_local_cols()
|
|
|
|
|
|
|
|
|
|
call a%csput(nz,ila,jla,val,1,nrow,1,ncol,info)
|
|
|
|
|
if (info /= psb_success_) then
|
|
|
|
|
call a%csput(nz,ila,jla,val,ione,nrow,ione,ncol,info)
|
|
|
|
|
if (psb_errstatus_fatal()) then
|
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
|
ch_err='psb_coins'
|
|
|
|
|
call psb_errpush(info,name,a_err=ch_err)
|
|
|
|
|
call psb_errpush(info,name,a_err='a%csput')
|
|
|
|
|
goto 9999
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
else if (psb_is_asb_desc(desc_ac)) then
|
|
|
|
|
else if (desc_ac%is_asb()) then
|
|
|
|
|
|
|
|
|
|
write(psb_err_unit,*) 'Why are you calling me on an assembled desc_ac?'
|
|
|
|
|
info = psb_err_invalid_cd_state_
|
|
|
|
|