|
|
@ -46,8 +46,11 @@ module psb_realloc_mod
|
|
|
|
|
|
|
|
|
|
|
|
interface psb_transfer
|
|
|
|
interface psb_transfer
|
|
|
|
module procedure psb_dtransfer1d
|
|
|
|
module procedure psb_dtransfer1d
|
|
|
|
|
|
|
|
module procedure psb_dtransfer2d
|
|
|
|
module procedure psb_itransfer1d
|
|
|
|
module procedure psb_itransfer1d
|
|
|
|
|
|
|
|
module procedure psb_itransfer2d
|
|
|
|
module procedure psb_ztransfer1d
|
|
|
|
module procedure psb_ztransfer1d
|
|
|
|
|
|
|
|
module procedure psb_ztransfer2d
|
|
|
|
end interface
|
|
|
|
end interface
|
|
|
|
|
|
|
|
|
|
|
|
Interface psb_safe_cpy
|
|
|
|
Interface psb_safe_cpy
|
|
|
@ -55,6 +58,10 @@ module psb_realloc_mod
|
|
|
|
& psb_dcpy1d, psb_dcpy2d, psb_zcpy1d, psb_zcpy2d
|
|
|
|
& psb_dcpy1d, psb_dcpy2d, psb_zcpy1d, psb_zcpy2d
|
|
|
|
end Interface
|
|
|
|
end Interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Interface psb_check_size
|
|
|
|
|
|
|
|
module procedure psb_icksz1d, psb_dcksz1d, psb_zcksz1d
|
|
|
|
|
|
|
|
end Interface
|
|
|
|
|
|
|
|
|
|
|
|
interface psb_size
|
|
|
|
interface psb_size
|
|
|
|
module procedure psb_isize1d, psb_isize2d,&
|
|
|
|
module procedure psb_isize1d, psb_isize2d,&
|
|
|
|
& psb_dsize1d, psb_dsize2d,&
|
|
|
|
& psb_dsize1d, psb_dsize2d,&
|
|
|
@ -400,6 +407,7 @@ Contains
|
|
|
|
psb_zsize1d = size(vin)
|
|
|
|
psb_zsize1d = size(vin)
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
end function psb_zsize1d
|
|
|
|
end function psb_zsize1d
|
|
|
|
|
|
|
|
|
|
|
|
function psb_zsize2d(vin,dim)
|
|
|
|
function psb_zsize2d(vin,dim)
|
|
|
|
integer :: psb_zsize2d
|
|
|
|
integer :: psb_zsize2d
|
|
|
|
complex(kind(1.d0)), allocatable, intent(in) :: vin(:,:)
|
|
|
|
complex(kind(1.d0)), allocatable, intent(in) :: vin(:,:)
|
|
|
@ -417,7 +425,157 @@ Contains
|
|
|
|
end function psb_zsize2d
|
|
|
|
end function psb_zsize2d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subroutine psb_dreallocate1i(len,rrax,info,pad)
|
|
|
|
Subroutine psb_icksz1d(len,v,info,pad)
|
|
|
|
|
|
|
|
use psb_error_mod
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
! ...Subroutine Arguments
|
|
|
|
|
|
|
|
Integer,Intent(in) :: len
|
|
|
|
|
|
|
|
Integer,allocatable, intent(inout) :: v(:)
|
|
|
|
|
|
|
|
integer :: info
|
|
|
|
|
|
|
|
integer, optional, intent(in) :: pad
|
|
|
|
|
|
|
|
! ...Local Variables
|
|
|
|
|
|
|
|
character(len=20) :: name
|
|
|
|
|
|
|
|
logical, parameter :: debug=.false.
|
|
|
|
|
|
|
|
integer :: isz, err_act
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
name='psb_check_size'
|
|
|
|
|
|
|
|
call psb_erractionsave(err_act)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(psb_get_errstatus().ne.0) return
|
|
|
|
|
|
|
|
info=0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If (len > psb_size(v)) Then
|
|
|
|
|
|
|
|
isz = max((3*psb_size(v))/2,(len+1))
|
|
|
|
|
|
|
|
if (present(pad)) then
|
|
|
|
|
|
|
|
call psb_realloc(isz,v,info,pad=pad)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
call psb_realloc(isz,v,info)
|
|
|
|
|
|
|
|
if (info /= 0) then
|
|
|
|
|
|
|
|
info=4010
|
|
|
|
|
|
|
|
call psb_errpush(info,name,a_err='psb_realloc')
|
|
|
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
end If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call psb_erractionrestore(err_act)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9999 continue
|
|
|
|
|
|
|
|
call psb_erractionrestore(err_act)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (err_act.eq.act_ret) then
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
call psb_error()
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
End Subroutine psb_icksz1d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subroutine psb_dcksz1d(len,v,info,pad)
|
|
|
|
|
|
|
|
use psb_error_mod
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
! ...Subroutine Arguments
|
|
|
|
|
|
|
|
Integer,Intent(in) :: len
|
|
|
|
|
|
|
|
real(kind(1.d0)),allocatable, intent(inout) :: v(:)
|
|
|
|
|
|
|
|
integer :: info
|
|
|
|
|
|
|
|
real(kind(1.d0)), optional, intent(in) :: pad
|
|
|
|
|
|
|
|
! ...Local Variables
|
|
|
|
|
|
|
|
character(len=20) :: name
|
|
|
|
|
|
|
|
logical, parameter :: debug=.false.
|
|
|
|
|
|
|
|
integer :: isz, err_act
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
name='psb_check_size'
|
|
|
|
|
|
|
|
call psb_erractionsave(err_act)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(psb_get_errstatus().ne.0) return
|
|
|
|
|
|
|
|
info=0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If (len > psb_size(v)) Then
|
|
|
|
|
|
|
|
isz = max((3*psb_size(v))/2,(len+1))
|
|
|
|
|
|
|
|
if (present(pad)) then
|
|
|
|
|
|
|
|
call psb_realloc(isz,v,info,pad=pad)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
call psb_realloc(isz,v,info)
|
|
|
|
|
|
|
|
if (info /= 0) then
|
|
|
|
|
|
|
|
info=4010
|
|
|
|
|
|
|
|
call psb_errpush(info,name,a_err='psb_realloc')
|
|
|
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
end If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call psb_erractionrestore(err_act)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9999 continue
|
|
|
|
|
|
|
|
call psb_erractionrestore(err_act)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (err_act.eq.act_ret) then
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
call psb_error()
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
End Subroutine psb_dcksz1d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subroutine psb_zcksz1d(len,v,info,pad)
|
|
|
|
|
|
|
|
use psb_error_mod
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
! ...Subroutine Arguments
|
|
|
|
|
|
|
|
Integer,Intent(in) :: len
|
|
|
|
|
|
|
|
complex(kind(1.d0)),allocatable, intent(inout) :: v(:)
|
|
|
|
|
|
|
|
integer :: info
|
|
|
|
|
|
|
|
complex(kind(1.d0)), optional, intent(in) :: pad
|
|
|
|
|
|
|
|
! ...Local Variables
|
|
|
|
|
|
|
|
character(len=20) :: name
|
|
|
|
|
|
|
|
logical, parameter :: debug=.false.
|
|
|
|
|
|
|
|
integer :: isz, err_act
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
name='psb_check_size'
|
|
|
|
|
|
|
|
call psb_erractionsave(err_act)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(psb_get_errstatus().ne.0) return
|
|
|
|
|
|
|
|
info=0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If (len > psb_size(v)) Then
|
|
|
|
|
|
|
|
isz = max((3*psb_size(v))/2,(len+1))
|
|
|
|
|
|
|
|
if (present(pad)) then
|
|
|
|
|
|
|
|
call psb_realloc(isz,v,info,pad=pad)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
call psb_realloc(isz,v,info)
|
|
|
|
|
|
|
|
if (info /= 0) then
|
|
|
|
|
|
|
|
info=4010
|
|
|
|
|
|
|
|
call psb_errpush(info,name,a_err='psb_realloc')
|
|
|
|
|
|
|
|
goto 9999
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
end If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call psb_erractionrestore(err_act)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9999 continue
|
|
|
|
|
|
|
|
call psb_erractionrestore(err_act)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (err_act.eq.act_ret) then
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
call psb_error()
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
End Subroutine psb_zcksz1d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subroutine psb_dreallocate1i(len,rrax,info,pad,lb)
|
|
|
|
use psb_error_mod
|
|
|
|
use psb_error_mod
|
|
|
|
|
|
|
|
|
|
|
|
! ...Subroutine Arguments
|
|
|
|
! ...Subroutine Arguments
|
|
|
@ -425,9 +583,10 @@ Contains
|
|
|
|
Integer,allocatable, intent(inout) :: rrax(:)
|
|
|
|
Integer,allocatable, intent(inout) :: rrax(:)
|
|
|
|
integer :: info
|
|
|
|
integer :: info
|
|
|
|
integer, optional, intent(in) :: pad
|
|
|
|
integer, optional, intent(in) :: pad
|
|
|
|
|
|
|
|
integer, optional, intent(in) :: lb
|
|
|
|
! ...Local Variables
|
|
|
|
! ...Local Variables
|
|
|
|
Integer,allocatable :: tmp(:)
|
|
|
|
Integer,allocatable :: tmp(:)
|
|
|
|
Integer :: dim, err_act, err,i
|
|
|
|
Integer :: dim, err_act, err,i,lb_
|
|
|
|
character(len=20) :: name
|
|
|
|
character(len=20) :: name
|
|
|
|
logical, parameter :: debug=.false.
|
|
|
|
logical, parameter :: debug=.false.
|
|
|
|
|
|
|
|
|
|
|
@ -437,10 +596,16 @@ Contains
|
|
|
|
if(psb_get_errstatus().ne.0) return
|
|
|
|
if(psb_get_errstatus().ne.0) return
|
|
|
|
info=0
|
|
|
|
info=0
|
|
|
|
if (debug) write(0,*) 'reallocate I',len
|
|
|
|
if (debug) write(0,*) 'reallocate I',len
|
|
|
|
|
|
|
|
if (present(lb)) then
|
|
|
|
|
|
|
|
lb_ = lb
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
lb_ = 1
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
if (allocated(rrax)) then
|
|
|
|
if (allocated(rrax)) then
|
|
|
|
dim=size(rrax)
|
|
|
|
dim=size(rrax)
|
|
|
|
If (dim /= len) Then
|
|
|
|
If (dim /= len) Then
|
|
|
|
Allocate(tmp(len),stat=info)
|
|
|
|
Allocate(tmp(lb_:len),stat=info)
|
|
|
|
if (info /= 0) then
|
|
|
|
if (info /= 0) then
|
|
|
|
err=4000
|
|
|
|
err=4000
|
|
|
|
call psb_errpush(err,name)
|
|
|
|
call psb_errpush(err,name)
|
|
|
@ -448,12 +613,12 @@ Contains
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
tmp(1:min(len,dim))=rrax(1:min(len,dim))
|
|
|
|
tmp(1:min(len,dim))=rrax(1:min(len,dim))
|
|
|
|
|
|
|
|
|
|
|
|
call move_alloc(tmp,rrax)
|
|
|
|
call psb_transfer(tmp,rrax,info)
|
|
|
|
|
|
|
|
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
else
|
|
|
|
else
|
|
|
|
dim = 0
|
|
|
|
dim = 0
|
|
|
|
allocate(rrax(len),stat=info)
|
|
|
|
allocate(rrax(lb_:len),stat=info)
|
|
|
|
if (info /= 0) then
|
|
|
|
if (info /= 0) then
|
|
|
|
err=4000
|
|
|
|
err=4000
|
|
|
|
call psb_errpush(err,name)
|
|
|
|
call psb_errpush(err,name)
|
|
|
@ -481,7 +646,7 @@ Contains
|
|
|
|
End Subroutine psb_dreallocate1i
|
|
|
|
End Subroutine psb_dreallocate1i
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subroutine psb_dreallocate1d(len,rrax,info,pad)
|
|
|
|
Subroutine psb_dreallocate1d(len,rrax,info,pad,lb)
|
|
|
|
use psb_error_mod
|
|
|
|
use psb_error_mod
|
|
|
|
|
|
|
|
|
|
|
|
! ...Subroutine Arguments
|
|
|
|
! ...Subroutine Arguments
|
|
|
@ -489,10 +654,11 @@ Contains
|
|
|
|
Real(kind(1.d0)),allocatable, intent(inout) :: rrax(:)
|
|
|
|
Real(kind(1.d0)),allocatable, intent(inout) :: rrax(:)
|
|
|
|
integer :: info
|
|
|
|
integer :: info
|
|
|
|
real(kind(1.d0)), optional, intent(in) :: pad
|
|
|
|
real(kind(1.d0)), optional, intent(in) :: pad
|
|
|
|
|
|
|
|
integer, optional, intent(in) :: lb
|
|
|
|
|
|
|
|
|
|
|
|
! ...Local Variables
|
|
|
|
! ...Local Variables
|
|
|
|
Real(kind(1.d0)),allocatable :: tmp(:)
|
|
|
|
Real(kind(1.d0)),allocatable :: tmp(:)
|
|
|
|
Integer :: dim,err_act,err,i, m
|
|
|
|
Integer :: dim,err_act,err,i, m, lb_
|
|
|
|
character(len=20) :: name
|
|
|
|
character(len=20) :: name
|
|
|
|
logical, parameter :: debug=.false.
|
|
|
|
logical, parameter :: debug=.false.
|
|
|
|
|
|
|
|
|
|
|
@ -501,11 +667,17 @@ Contains
|
|
|
|
info = 0
|
|
|
|
info = 0
|
|
|
|
if (debug) write(0,*) 'reallocate D',len
|
|
|
|
if (debug) write(0,*) 'reallocate D',len
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (present(lb)) then
|
|
|
|
|
|
|
|
lb_ = lb
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
lb_ = 1
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
if (allocated(rrax)) then
|
|
|
|
if (allocated(rrax)) then
|
|
|
|
dim=size(rrax)
|
|
|
|
dim=size(rrax)
|
|
|
|
|
|
|
|
|
|
|
|
If (dim /= len) Then
|
|
|
|
If (dim /= len) Then
|
|
|
|
Allocate(tmp(len),stat=info)
|
|
|
|
Allocate(tmp(lb_:len),stat=info)
|
|
|
|
if (info /= 0) then
|
|
|
|
if (info /= 0) then
|
|
|
|
err=4000
|
|
|
|
err=4000
|
|
|
|
call psb_errpush(err,name)
|
|
|
|
call psb_errpush(err,name)
|
|
|
@ -514,12 +686,12 @@ Contains
|
|
|
|
m = min(dim,len)
|
|
|
|
m = min(dim,len)
|
|
|
|
tmp(1:m) = rrax(1:m)
|
|
|
|
tmp(1:m) = rrax(1:m)
|
|
|
|
|
|
|
|
|
|
|
|
call move_alloc(tmp,rrax)
|
|
|
|
call psb_transfer(tmp,rrax,info)
|
|
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
else
|
|
|
|
else
|
|
|
|
dim = 0
|
|
|
|
dim = 0
|
|
|
|
Allocate(rrax(len),stat=info)
|
|
|
|
Allocate(rrax(lb_:len),stat=info)
|
|
|
|
if (info /= 0) then
|
|
|
|
if (info /= 0) then
|
|
|
|
err=4000
|
|
|
|
err=4000
|
|
|
|
call psb_errpush(err,name)
|
|
|
|
call psb_errpush(err,name)
|
|
|
@ -578,7 +750,7 @@ Contains
|
|
|
|
m = min(dim,len)
|
|
|
|
m = min(dim,len)
|
|
|
|
tmp(1:m) = rrax(1:m)
|
|
|
|
tmp(1:m) = rrax(1:m)
|
|
|
|
|
|
|
|
|
|
|
|
call move_alloc(tmp,rrax)
|
|
|
|
call psb_transfer(tmp,rrax,info)
|
|
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -642,7 +814,7 @@ Contains
|
|
|
|
m = min(dim,len1)
|
|
|
|
m = min(dim,len1)
|
|
|
|
tmp(1:m,1:min(len2,dim2)) = rrax(1:m,1:min(len2,dim2))
|
|
|
|
tmp(1:m,1:min(len2,dim2)) = rrax(1:m,1:min(len2,dim2))
|
|
|
|
|
|
|
|
|
|
|
|
call move_alloc(tmp,rrax)
|
|
|
|
call psb_transfer(tmp,rrax,info)
|
|
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -708,7 +880,7 @@ Contains
|
|
|
|
m = min(dim,len1)
|
|
|
|
m = min(dim,len1)
|
|
|
|
tmp(1:m,1:min(len2,dim2)) = rrax(1:m,1:min(len2,dim2))
|
|
|
|
tmp(1:m,1:min(len2,dim2)) = rrax(1:m,1:min(len2,dim2))
|
|
|
|
|
|
|
|
|
|
|
|
call move_alloc(tmp,rrax)
|
|
|
|
call psb_transfer(tmp,rrax,info)
|
|
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -771,7 +943,7 @@ Contains
|
|
|
|
m = min(dim,len1)
|
|
|
|
m = min(dim,len1)
|
|
|
|
tmp(1:m,1:min(len2,dim2)) = rrax(1:m,1:min(len2,dim2))
|
|
|
|
tmp(1:m,1:min(len2,dim2)) = rrax(1:m,1:min(len2,dim2))
|
|
|
|
|
|
|
|
|
|
|
|
call move_alloc(tmp,rrax)
|
|
|
|
call psb_transfer(tmp,rrax,info)
|
|
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -945,98 +1117,226 @@ Contains
|
|
|
|
return
|
|
|
|
return
|
|
|
|
End Subroutine psb_dreallocate2i1z
|
|
|
|
End Subroutine psb_dreallocate2i1z
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subroutine psb_dtransfer1d(vin,vout,info)
|
|
|
|
Subroutine psb_dtransfer1d(vin,vout,info)
|
|
|
|
use psb_error_mod
|
|
|
|
use psb_error_mod
|
|
|
|
real(kind(1.d0)), allocatable, intent(inout) :: vin(:),vout(:)
|
|
|
|
real(kind(1.d0)), allocatable, intent(inout) :: vin(:),vout(:)
|
|
|
|
integer, intent(out) :: info
|
|
|
|
integer, intent(out) :: info
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! To be reimplemented with MOVE_ALLOC
|
|
|
|
|
|
|
|
!
|
|
|
|
!
|
|
|
|
info = 0
|
|
|
|
info = 0
|
|
|
|
|
|
|
|
#ifdef HAVE_MOVE_ALLOC
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (allocated(vin)) then
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
!!$
|
|
|
|
else if (allocated(vout)) then
|
|
|
|
!!$ if (.not.allocated(vin) ) then
|
|
|
|
write(0,*) 'transfer: Clearing output'
|
|
|
|
!!$ if (allocated(vout)) then
|
|
|
|
deallocate(vout)
|
|
|
|
!!$ deallocate(vout,stat=info)
|
|
|
|
end if
|
|
|
|
!!$ end if
|
|
|
|
|
|
|
|
!!$ else if (allocated(vin)) then
|
|
|
|
#else
|
|
|
|
!!$ if (.not.allocated(vout)) then
|
|
|
|
|
|
|
|
!!$ allocate(vout(size(vin)),stat=info)
|
|
|
|
if (.not.allocated(vin) ) then
|
|
|
|
!!$ if (info /= 0) return
|
|
|
|
if (allocated(vout)) then
|
|
|
|
!!$ else
|
|
|
|
deallocate(vout,stat=info)
|
|
|
|
!!$ if (size(vout) /= size(vin)) then
|
|
|
|
end if
|
|
|
|
!!$ deallocate(vout,stat=info)
|
|
|
|
else if (allocated(vin)) then
|
|
|
|
!!$ if (info /= 0) return
|
|
|
|
if (.not.allocated(vout)) then
|
|
|
|
!!$ allocate(vout(size(vin)),stat=info)
|
|
|
|
allocate(vout(size(vin)),stat=info)
|
|
|
|
!!$ if (info /= 0) return
|
|
|
|
if (info /= 0) return
|
|
|
|
!!$ end if
|
|
|
|
else
|
|
|
|
!!$ end if
|
|
|
|
if (size(vout) /= size(vin)) then
|
|
|
|
!!$ vout = vin
|
|
|
|
deallocate(vout,stat=info)
|
|
|
|
!!$ deallocate(vin,stat=info)
|
|
|
|
if (info /= 0) return
|
|
|
|
!!$ end if
|
|
|
|
allocate(vout(size(vin)),stat=info)
|
|
|
|
|
|
|
|
if (info /= 0) return
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
vout = vin
|
|
|
|
|
|
|
|
deallocate(vin,stat=info)
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
#endif
|
|
|
|
end Subroutine psb_dtransfer1d
|
|
|
|
end Subroutine psb_dtransfer1d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subroutine psb_dtransfer2d(vin,vout,info)
|
|
|
|
|
|
|
|
use psb_error_mod
|
|
|
|
|
|
|
|
real(kind(1.d0)), allocatable, intent(inout) :: vin(:,:),vout(:,:)
|
|
|
|
|
|
|
|
integer, intent(out) :: info
|
|
|
|
|
|
|
|
!
|
|
|
|
|
|
|
|
!
|
|
|
|
|
|
|
|
info = 0
|
|
|
|
|
|
|
|
#ifdef HAVE_MOVE_ALLOC
|
|
|
|
|
|
|
|
if (allocated(vin)) then
|
|
|
|
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
|
|
|
|
else if (allocated(vout)) then
|
|
|
|
|
|
|
|
deallocate(vout)
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (.not.allocated(vin) ) then
|
|
|
|
|
|
|
|
if (allocated(vout)) then
|
|
|
|
|
|
|
|
deallocate(vout,stat=info)
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
else if (allocated(vin)) then
|
|
|
|
|
|
|
|
if (.not.allocated(vout)) then
|
|
|
|
|
|
|
|
allocate(vout(size(vin,1),size(vin,2)),stat=info)
|
|
|
|
|
|
|
|
if (info /= 0) return
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
if (size(vout) /= size(vin)) then
|
|
|
|
|
|
|
|
deallocate(vout,stat=info)
|
|
|
|
|
|
|
|
if (info /= 0) return
|
|
|
|
|
|
|
|
allocate(vout(size(vin,1),size(vin,2)),stat=info)
|
|
|
|
|
|
|
|
if (info /= 0) return
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
vout = vin
|
|
|
|
|
|
|
|
deallocate(vin,stat=info)
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
end Subroutine psb_dtransfer2d
|
|
|
|
|
|
|
|
|
|
|
|
Subroutine psb_ztransfer1d(vin,vout,info)
|
|
|
|
Subroutine psb_ztransfer1d(vin,vout,info)
|
|
|
|
use psb_error_mod
|
|
|
|
use psb_error_mod
|
|
|
|
complex(kind(1.d0)), allocatable, intent(inout) :: vin(:),vout(:)
|
|
|
|
complex(kind(1.d0)), allocatable, intent(inout) :: vin(:),vout(:)
|
|
|
|
integer, intent(out) :: info
|
|
|
|
integer, intent(out) :: info
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! To be reimplemented with MOVE_ALLOC
|
|
|
|
|
|
|
|
!
|
|
|
|
!
|
|
|
|
info = 0
|
|
|
|
info = 0
|
|
|
|
|
|
|
|
#ifdef HAVE_MOVE_ALLOC
|
|
|
|
|
|
|
|
if (allocated(vin)) then
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
!!$ if (.not.allocated(vin) ) then
|
|
|
|
else if (allocated(vout)) then
|
|
|
|
!!$ if (allocated(vout)) then
|
|
|
|
deallocate(vout)
|
|
|
|
!!$ deallocate(vout,stat=info)
|
|
|
|
end if
|
|
|
|
!!$ end if
|
|
|
|
#else
|
|
|
|
!!$ else if (allocated(vin)) then
|
|
|
|
if (.not.allocated(vin) ) then
|
|
|
|
!!$ if (.not.allocated(vout)) then
|
|
|
|
if (allocated(vout)) then
|
|
|
|
!!$ allocate(vout(size(vin)),stat=info)
|
|
|
|
deallocate(vout,stat=info)
|
|
|
|
!!$ if (info /= 0) return
|
|
|
|
end if
|
|
|
|
!!$ else
|
|
|
|
else if (allocated(vin)) then
|
|
|
|
!!$ if (size(vout) /= size(vin)) then
|
|
|
|
if (.not.allocated(vout)) then
|
|
|
|
!!$ deallocate(vout,stat=info)
|
|
|
|
allocate(vout(size(vin)),stat=info)
|
|
|
|
!!$ if (info /= 0) return
|
|
|
|
if (info /= 0) return
|
|
|
|
!!$ allocate(vout(size(vin)),stat=info)
|
|
|
|
else
|
|
|
|
!!$ if (info /= 0) return
|
|
|
|
if (size(vout) /= size(vin)) then
|
|
|
|
!!$ end if
|
|
|
|
deallocate(vout,stat=info)
|
|
|
|
!!$ end if
|
|
|
|
if (info /= 0) return
|
|
|
|
!!$ vout = vin
|
|
|
|
allocate(vout(size(vin)),stat=info)
|
|
|
|
!!$ deallocate(vin,stat=info)
|
|
|
|
if (info /= 0) return
|
|
|
|
!!$ end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
vout = vin
|
|
|
|
|
|
|
|
deallocate(vin,stat=info)
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
#endif
|
|
|
|
end Subroutine psb_ztransfer1d
|
|
|
|
end Subroutine psb_ztransfer1d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subroutine psb_ztransfer2d(vin,vout,info)
|
|
|
|
|
|
|
|
use psb_error_mod
|
|
|
|
|
|
|
|
complex(kind(1.d0)), allocatable, intent(inout) :: vin(:,:),vout(:,:)
|
|
|
|
|
|
|
|
integer, intent(out) :: info
|
|
|
|
|
|
|
|
!
|
|
|
|
|
|
|
|
!
|
|
|
|
|
|
|
|
info = 0
|
|
|
|
|
|
|
|
#ifdef HAVE_MOVE_ALLOC
|
|
|
|
|
|
|
|
if (allocated(vin)) then
|
|
|
|
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
|
|
|
|
else if (allocated(vout)) then
|
|
|
|
|
|
|
|
deallocate(vout)
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
if (.not.allocated(vin) ) then
|
|
|
|
|
|
|
|
if (allocated(vout)) then
|
|
|
|
|
|
|
|
deallocate(vout,stat=info)
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
else if (allocated(vin)) then
|
|
|
|
|
|
|
|
if (.not.allocated(vout)) then
|
|
|
|
|
|
|
|
allocate(vout(size(vin,1),size(vin,2)),stat=info)
|
|
|
|
|
|
|
|
if (info /= 0) return
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
if (size(vout) /= size(vin)) then
|
|
|
|
|
|
|
|
deallocate(vout,stat=info)
|
|
|
|
|
|
|
|
if (info /= 0) return
|
|
|
|
|
|
|
|
allocate(vout(size(vin,1),size(vin,2)),stat=info)
|
|
|
|
|
|
|
|
if (info /= 0) return
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
vout = vin
|
|
|
|
|
|
|
|
deallocate(vin,stat=info)
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
end Subroutine psb_ztransfer2d
|
|
|
|
|
|
|
|
|
|
|
|
Subroutine psb_itransfer1d(vin,vout,info)
|
|
|
|
Subroutine psb_itransfer1d(vin,vout,info)
|
|
|
|
use psb_error_mod
|
|
|
|
use psb_error_mod
|
|
|
|
integer, allocatable, intent(inout) :: vin(:),vout(:)
|
|
|
|
integer, allocatable, intent(inout) :: vin(:),vout(:)
|
|
|
|
integer, intent(out) :: info
|
|
|
|
integer, intent(out) :: info
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! To be reimplemented with MOVE_ALLOC
|
|
|
|
|
|
|
|
!
|
|
|
|
!
|
|
|
|
info = 0
|
|
|
|
info = 0
|
|
|
|
|
|
|
|
#ifdef HAVE_MOVE_ALLOC
|
|
|
|
|
|
|
|
if (allocated(vin)) then
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
!!$ if (.not.allocated(vin) ) then
|
|
|
|
else if (allocated(vout)) then
|
|
|
|
!!$ if (allocated(vout)) then
|
|
|
|
write(0,*) 'transfer: Clearing output'
|
|
|
|
!!$ deallocate(vout,stat=info)
|
|
|
|
deallocate(vout)
|
|
|
|
!!$ end if
|
|
|
|
end if
|
|
|
|
!!$ else if (allocated(vin)) then
|
|
|
|
#else
|
|
|
|
!!$ if (.not.allocated(vout)) then
|
|
|
|
if (.not.allocated(vin) ) then
|
|
|
|
!!$ allocate(vout(size(vin)),stat=info)
|
|
|
|
if (allocated(vout)) then
|
|
|
|
!!$ if (info /= 0) return
|
|
|
|
deallocate(vout,stat=info)
|
|
|
|
!!$ else
|
|
|
|
end if
|
|
|
|
!!$ if (size(vout) /= size(vin)) then
|
|
|
|
else if (allocated(vin)) then
|
|
|
|
!!$ deallocate(vout,stat=info)
|
|
|
|
if (.not.allocated(vout)) then
|
|
|
|
!!$ if (info /= 0) return
|
|
|
|
allocate(vout(size(vin)),stat=info)
|
|
|
|
!!$ allocate(vout(size(vin)),stat=info)
|
|
|
|
if (info /= 0) return
|
|
|
|
!!$ if (info /= 0) return
|
|
|
|
else
|
|
|
|
!!$ end if
|
|
|
|
if (size(vout) /= size(vin)) then
|
|
|
|
!!$ end if
|
|
|
|
deallocate(vout,stat=info)
|
|
|
|
!!$ vout = vin
|
|
|
|
if (info /= 0) return
|
|
|
|
!!$ deallocate(vin,stat=info)
|
|
|
|
allocate(vout(size(vin)),stat=info)
|
|
|
|
!!$ end if
|
|
|
|
if (info /= 0) return
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
vout = vin
|
|
|
|
|
|
|
|
deallocate(vin,stat=info)
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
#endif
|
|
|
|
end Subroutine psb_itransfer1d
|
|
|
|
end Subroutine psb_itransfer1d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subroutine psb_itransfer2d(vin,vout,info)
|
|
|
|
|
|
|
|
use psb_error_mod
|
|
|
|
|
|
|
|
integer, allocatable, intent(inout) :: vin(:,:),vout(:,:)
|
|
|
|
|
|
|
|
integer, intent(out) :: info
|
|
|
|
|
|
|
|
!
|
|
|
|
|
|
|
|
!
|
|
|
|
|
|
|
|
info = 0
|
|
|
|
|
|
|
|
#ifdef HAVE_MOVE_ALLOC
|
|
|
|
|
|
|
|
if (allocated(vin)) then
|
|
|
|
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
|
|
|
|
else if (allocated(vout)) then
|
|
|
|
|
|
|
|
deallocate(vout)
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
if (.not.allocated(vin) ) then
|
|
|
|
|
|
|
|
if (allocated(vout)) then
|
|
|
|
|
|
|
|
deallocate(vout,stat=info)
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
else if (allocated(vin)) then
|
|
|
|
|
|
|
|
if (.not.allocated(vout)) then
|
|
|
|
|
|
|
|
allocate(vout(size(vin,1),size(vin,2)),stat=info)
|
|
|
|
|
|
|
|
if (info /= 0) return
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
if (size(vout) /= size(vin)) then
|
|
|
|
|
|
|
|
deallocate(vout,stat=info)
|
|
|
|
|
|
|
|
if (info /= 0) return
|
|
|
|
|
|
|
|
allocate(vout(size(vin,1),size(vin,2)),stat=info)
|
|
|
|
|
|
|
|
if (info /= 0) return
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
vout = vin
|
|
|
|
|
|
|
|
deallocate(vin,stat=info)
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
end Subroutine psb_itransfer2d
|
|
|
|
|
|
|
|
|
|
|
|
end module psb_realloc_mod
|
|
|
|
end module psb_realloc_mod
|