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