New WRK methods in onelev data structure.

stopcriterion
Salvatore Filippone 7 years ago
parent 823db4f943
commit 554f21992f

@ -125,12 +125,17 @@ module mld_c_onelev_mod
type(psb_c_vect_type) :: vtx, vty, vx2l, vy2l
integer(psb_ipk_) :: wvsz = 0
type(psb_c_vect_type), allocatable :: wv(:)
contains
procedure, pass(wk) :: alloc => c_wrk_alloc
procedure, pass(wk) :: free => c_wrk_free
procedure, pass(wk) :: clone => c_wrk_clone
procedure, pass(wk) :: move_alloc => c_wrk_move_alloc
end type mld_cmlprec_wrk_type
type mld_c_onelev_type
class(mld_c_base_smoother_type), allocatable :: sm, sm2a
class(mld_c_base_smoother_type), pointer :: sm2 => null()
type(mld_cmlprec_wrk_type) :: wrk
class(mld_cmlprec_wrk_type), allocatable :: wrk
type(mld_sml_parms) :: parms
type(psb_cspmat_type) :: ac
integer(psb_ipk_) :: ac_nz_loc, ac_nz_tot
@ -177,7 +182,8 @@ module mld_c_onelev_mod
private :: c_base_onelev_default, c_base_onelev_sizeof, &
& c_base_onelev_nullify, c_base_onelev_get_nzeros, &
& c_base_onelev_clone, c_base_onelev_move_alloc, &
& c_base_onelev_get_wrksize, c_base_onelev_allocate_wrk, c_base_onelev_free_wrk
& c_base_onelev_get_wrksize, c_base_onelev_allocate_wrk, &
& c_base_onelev_free_wrk
@ -586,44 +592,137 @@ contains
integer(psb_ipk_) :: nwv, i
info = psb_success_
nwv = lv%get_wrksz()
call psb_geasb(lv%wrk%vx2l,&
& lv%base_desc,info,&
if (.not.allocated(lv%wrk)) allocate(lv%wrk,stat=info)
if (info == 0) call lv%wrk%alloc(nwv,lv%base_desc,info,vmold=vmold)
end subroutine c_base_onelev_allocate_wrk
subroutine c_base_onelev_free_wrk(lv,info)
use psb_base_mod
implicit none
class(mld_c_onelev_type), target, intent(inout) :: lv
integer(psb_ipk_), intent(out) :: info
!
integer(psb_ipk_) :: nwv,i
info = psb_success_
call lv%wrk%free(info)
if (info == 0) deallocate(lv%wrk,stat=info)
end subroutine c_base_onelev_free_wrk
subroutine c_wrk_alloc(wk,nwv,desc,info,vmold)
use psb_base_mod
Implicit None
! Arguments
class(mld_cmlprec_wrk_type), target, intent(inout) :: wk
integer(psb_ipk_), intent(in) :: nwv
type(psb_desc_type), intent(in) :: desc
integer(psb_ipk_), intent(out) :: info
class(psb_c_base_vect_type), intent(in), optional :: vmold
!
integer(psb_ipk_) :: i
info = psb_success_
call wk%free(info)
call psb_geasb(wk%vx2l,desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(lv%wrk%vy2l,&
& lv%base_desc,info,&
call psb_geasb(wk%vy2l,desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(lv%wrk%vtx,&
& lv%base_desc,info,&
call psb_geasb(wk%vtx,desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(lv%wrk%vty,&
& lv%base_desc,info,&
call psb_geasb(wk%vty,desc,info,&
& scratch=.true.,mold=vmold)
allocate(lv%wrk%wv(nwv),stat=info)
allocate(wk%wv(nwv),stat=info)
do i=1,nwv
call psb_geasb(lv%wrk%wv(i),&
& lv%base_desc,info,&
call psb_geasb(wk%wv(i),desc,info,&
& scratch=.true.,mold=vmold)
end do
end subroutine c_base_onelev_allocate_wrk
end subroutine c_wrk_alloc
subroutine c_base_onelev_free_wrk(lv,info)
subroutine c_wrk_free(wk,info)
Implicit None
! Arguments
class(mld_cmlprec_wrk_type), target, intent(inout) :: wk
integer(psb_ipk_), intent(out) :: info
!
integer(psb_ipk_) :: i
info = psb_success_
if (allocated(wk%tx)) deallocate(wk%tx, stat=info)
if (allocated(wk%ty)) deallocate(wk%ty, stat=info)
if (allocated(wk%x2l)) deallocate(wk%x2l, stat=info)
if (allocated(wk%y2l)) deallocate(wk%y2l, stat=info)
call wk%vtx%free(info)
call wk%vty%free(info)
call wk%vx2l%free(info)
call wk%vy2l%free(info)
if (allocated(wk%wv)) then
do i=1,size(wk%wv)
call wk%wv(i)%free(info)
end do
deallocate(wk%wv, stat=info)
end if
end subroutine c_wrk_free
subroutine c_wrk_clone(wk,wkout,info)
use psb_base_mod
implicit none
class(mld_c_onelev_type), target, intent(inout) :: lv
Implicit None
! Arguments
class(mld_cmlprec_wrk_type), target, intent(inout) :: wk
class(mld_cmlprec_wrk_type), target, intent(inout) :: wkout
integer(psb_ipk_), intent(out) :: info
!
integer(psb_ipk_) :: nwv,i
integer(psb_ipk_) :: i
info = psb_success_
call lv%wrk%vx2l%free(info)
call lv%wrk%vy2l%free(info)
call lv%wrk%vtx%free(info)
call lv%wrk%vty%free(info)
nwv = size(lv%wrk%wv)
do i=1,nwv
call lv%wrk%wv(i)%free(info)
call psb_safe_ab_cpy(wk%tx,wkout%tx,info)
call psb_safe_ab_cpy(wk%ty,wkout%ty,info)
call psb_safe_ab_cpy(wk%x2l,wkout%x2l,info)
call psb_safe_ab_cpy(wk%y2l,wkout%y2l,info)
call wk%vtx%clone(wkout%vtx,info)
call wk%vty%clone(wkout%vty,info)
call wk%vx2l%clone(wkout%vx2l,info)
call wk%vy2l%clone(wkout%vy2l,info)
if (allocated(wkout%wv)) then
do i=1,size(wkout%wv)
call wkout%wv(i)%free(info)
end do
deallocate( wkout%wv)
end if
allocate(wkout%wv(size(wk%wv)),stat=info)
do i=1,size(wk%wv)
call wk%wv(i)%clone(wkout%wv(i),info)
end do
return
end subroutine c_base_onelev_free_wrk
end subroutine c_wrk_clone
subroutine c_wrk_move_alloc(wk, b,info)
implicit none
class(mld_cmlprec_wrk_type), target, intent(inout) :: wk, b
integer(psb_ipk_), intent(out) :: info
call b%free(info)
call move_alloc(wk%tx,b%tx)
call move_alloc(wk%ty,b%ty)
call move_alloc(wk%x2l,b%x2l)
call move_alloc(wk%y2l,b%y2l)
!
! Should define V%move_alloc....
call move_alloc(wk%vtx%v,b%vtx%v)
call move_alloc(wk%vty%v,b%vty%v)
call move_alloc(wk%vx2l%v,b%vx2l%v)
call move_alloc(wk%vy2l%v,b%vy2l%v)
call move_alloc(wk%wv,b%wv)
end subroutine c_wrk_move_alloc
end module mld_c_onelev_mod

@ -852,24 +852,24 @@ contains
level = 1
do level = 1, nlev
call prec%precv(level)%allocate_wrk(info,vmold=vmold)
call psb_geasb(prec%wrk(level)%vx2l,&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(prec%wrk(level)%vy2l,&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(prec%wrk(level)%vtx,&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(prec%wrk(level)%vty,&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
allocate(prec%wrk(level)%wv(wv_size_),stat=info)
do j=1, wv_size_
call psb_geasb(prec%wrk(level)%wv(j),&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
end do
!!$ call psb_geasb(prec%wrk(level)%vx2l,&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ call psb_geasb(prec%wrk(level)%vy2l,&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ call psb_geasb(prec%wrk(level)%vtx,&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ call psb_geasb(prec%wrk(level)%vty,&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ allocate(prec%wrk(level)%wv(wv_size_),stat=info)
!!$ do j=1, wv_size_
!!$ call psb_geasb(prec%wrk(level)%wv(j),&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ end do
if (psb_errstatus_fatal()) then
nc2l = prec%precv(level)%base_desc%get_local_cols()
info=psb_err_alloc_request_
@ -912,14 +912,14 @@ contains
do level = 1, nlev
call prec%precv(level)%free_wrk(info)
!write(0,*) 'Free at level ',level,': x2,y2,tx,ty'
call prec%wrk(level)%vx2l%free(info)
call prec%wrk(level)%vy2l%free(info)
call prec%wrk(level)%vtx%free(info)
call prec%wrk(level)%vty%free(info)
!write(0,*) 'Free at level ',level,': vw[123]'
do j=1,wv_size_
call prec%wrk(level)%wv(j)%free(info)
end do
!!$ call prec%wrk(level)%vx2l%free(info)
!!$ call prec%wrk(level)%vy2l%free(info)
!!$ call prec%wrk(level)%vtx%free(info)
!!$ call prec%wrk(level)%vty%free(info)
!!$ !write(0,*) 'Free at level ',level,': vw[123]'
!!$ do j=1,wv_size_
!!$ call prec%wrk(level)%wv(j)%free(info)
!!$ end do
!write(0,*) 'Free at level ',level,': done'
if (psb_errstatus_fatal()) then
info=psb_err_alloc_request_

@ -125,12 +125,17 @@ module mld_d_onelev_mod
type(psb_d_vect_type) :: vtx, vty, vx2l, vy2l
integer(psb_ipk_) :: wvsz = 0
type(psb_d_vect_type), allocatable :: wv(:)
contains
procedure, pass(wk) :: alloc => d_wrk_alloc
procedure, pass(wk) :: free => d_wrk_free
procedure, pass(wk) :: clone => d_wrk_clone
procedure, pass(wk) :: move_alloc => d_wrk_move_alloc
end type mld_dmlprec_wrk_type
type mld_d_onelev_type
class(mld_d_base_smoother_type), allocatable :: sm, sm2a
class(mld_d_base_smoother_type), pointer :: sm2 => null()
type(mld_dmlprec_wrk_type) :: wrk
class(mld_dmlprec_wrk_type), allocatable :: wrk
type(mld_dml_parms) :: parms
type(psb_dspmat_type) :: ac
integer(psb_ipk_) :: ac_nz_loc, ac_nz_tot
@ -177,7 +182,8 @@ module mld_d_onelev_mod
private :: d_base_onelev_default, d_base_onelev_sizeof, &
& d_base_onelev_nullify, d_base_onelev_get_nzeros, &
& d_base_onelev_clone, d_base_onelev_move_alloc, &
& d_base_onelev_get_wrksize, d_base_onelev_allocate_wrk, d_base_onelev_free_wrk
& d_base_onelev_get_wrksize, d_base_onelev_allocate_wrk, &
& d_base_onelev_free_wrk
@ -586,44 +592,137 @@ contains
integer(psb_ipk_) :: nwv, i
info = psb_success_
nwv = lv%get_wrksz()
call psb_geasb(lv%wrk%vx2l,&
& lv%base_desc,info,&
if (.not.allocated(lv%wrk)) allocate(lv%wrk,stat=info)
if (info == 0) call lv%wrk%alloc(nwv,lv%base_desc,info,vmold=vmold)
end subroutine d_base_onelev_allocate_wrk
subroutine d_base_onelev_free_wrk(lv,info)
use psb_base_mod
implicit none
class(mld_d_onelev_type), target, intent(inout) :: lv
integer(psb_ipk_), intent(out) :: info
!
integer(psb_ipk_) :: nwv,i
info = psb_success_
call lv%wrk%free(info)
if (info == 0) deallocate(lv%wrk,stat=info)
end subroutine d_base_onelev_free_wrk
subroutine d_wrk_alloc(wk,nwv,desc,info,vmold)
use psb_base_mod
Implicit None
! Arguments
class(mld_dmlprec_wrk_type), target, intent(inout) :: wk
integer(psb_ipk_), intent(in) :: nwv
type(psb_desc_type), intent(in) :: desc
integer(psb_ipk_), intent(out) :: info
class(psb_d_base_vect_type), intent(in), optional :: vmold
!
integer(psb_ipk_) :: i
info = psb_success_
call wk%free(info)
call psb_geasb(wk%vx2l,desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(lv%wrk%vy2l,&
& lv%base_desc,info,&
call psb_geasb(wk%vy2l,desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(lv%wrk%vtx,&
& lv%base_desc,info,&
call psb_geasb(wk%vtx,desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(lv%wrk%vty,&
& lv%base_desc,info,&
call psb_geasb(wk%vty,desc,info,&
& scratch=.true.,mold=vmold)
allocate(lv%wrk%wv(nwv),stat=info)
allocate(wk%wv(nwv),stat=info)
do i=1,nwv
call psb_geasb(lv%wrk%wv(i),&
& lv%base_desc,info,&
call psb_geasb(wk%wv(i),desc,info,&
& scratch=.true.,mold=vmold)
end do
end subroutine d_base_onelev_allocate_wrk
end subroutine d_wrk_alloc
subroutine d_base_onelev_free_wrk(lv,info)
subroutine d_wrk_free(wk,info)
Implicit None
! Arguments
class(mld_dmlprec_wrk_type), target, intent(inout) :: wk
integer(psb_ipk_), intent(out) :: info
!
integer(psb_ipk_) :: i
info = psb_success_
if (allocated(wk%tx)) deallocate(wk%tx, stat=info)
if (allocated(wk%ty)) deallocate(wk%ty, stat=info)
if (allocated(wk%x2l)) deallocate(wk%x2l, stat=info)
if (allocated(wk%y2l)) deallocate(wk%y2l, stat=info)
call wk%vtx%free(info)
call wk%vty%free(info)
call wk%vx2l%free(info)
call wk%vy2l%free(info)
if (allocated(wk%wv)) then
do i=1,size(wk%wv)
call wk%wv(i)%free(info)
end do
deallocate(wk%wv, stat=info)
end if
end subroutine d_wrk_free
subroutine d_wrk_clone(wk,wkout,info)
use psb_base_mod
implicit none
class(mld_d_onelev_type), target, intent(inout) :: lv
Implicit None
! Arguments
class(mld_dmlprec_wrk_type), target, intent(inout) :: wk
class(mld_dmlprec_wrk_type), target, intent(inout) :: wkout
integer(psb_ipk_), intent(out) :: info
!
integer(psb_ipk_) :: nwv,i
integer(psb_ipk_) :: i
info = psb_success_
call lv%wrk%vx2l%free(info)
call lv%wrk%vy2l%free(info)
call lv%wrk%vtx%free(info)
call lv%wrk%vty%free(info)
nwv = size(lv%wrk%wv)
do i=1,nwv
call lv%wrk%wv(i)%free(info)
call psb_safe_ab_cpy(wk%tx,wkout%tx,info)
call psb_safe_ab_cpy(wk%ty,wkout%ty,info)
call psb_safe_ab_cpy(wk%x2l,wkout%x2l,info)
call psb_safe_ab_cpy(wk%y2l,wkout%y2l,info)
call wk%vtx%clone(wkout%vtx,info)
call wk%vty%clone(wkout%vty,info)
call wk%vx2l%clone(wkout%vx2l,info)
call wk%vy2l%clone(wkout%vy2l,info)
if (allocated(wkout%wv)) then
do i=1,size(wkout%wv)
call wkout%wv(i)%free(info)
end do
deallocate( wkout%wv)
end if
allocate(wkout%wv(size(wk%wv)),stat=info)
do i=1,size(wk%wv)
call wk%wv(i)%clone(wkout%wv(i),info)
end do
return
end subroutine d_base_onelev_free_wrk
end subroutine d_wrk_clone
subroutine d_wrk_move_alloc(wk, b,info)
implicit none
class(mld_dmlprec_wrk_type), target, intent(inout) :: wk, b
integer(psb_ipk_), intent(out) :: info
call b%free(info)
call move_alloc(wk%tx,b%tx)
call move_alloc(wk%ty,b%ty)
call move_alloc(wk%x2l,b%x2l)
call move_alloc(wk%y2l,b%y2l)
!
! Should define V%move_alloc....
call move_alloc(wk%vtx%v,b%vtx%v)
call move_alloc(wk%vty%v,b%vty%v)
call move_alloc(wk%vx2l%v,b%vx2l%v)
call move_alloc(wk%vy2l%v,b%vy2l%v)
call move_alloc(wk%wv,b%wv)
end subroutine d_wrk_move_alloc
end module mld_d_onelev_mod

@ -852,24 +852,24 @@ contains
level = 1
do level = 1, nlev
call prec%precv(level)%allocate_wrk(info,vmold=vmold)
call psb_geasb(prec%wrk(level)%vx2l,&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(prec%wrk(level)%vy2l,&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(prec%wrk(level)%vtx,&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(prec%wrk(level)%vty,&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
allocate(prec%wrk(level)%wv(wv_size_),stat=info)
do j=1, wv_size_
call psb_geasb(prec%wrk(level)%wv(j),&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
end do
!!$ call psb_geasb(prec%wrk(level)%vx2l,&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ call psb_geasb(prec%wrk(level)%vy2l,&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ call psb_geasb(prec%wrk(level)%vtx,&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ call psb_geasb(prec%wrk(level)%vty,&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ allocate(prec%wrk(level)%wv(wv_size_),stat=info)
!!$ do j=1, wv_size_
!!$ call psb_geasb(prec%wrk(level)%wv(j),&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ end do
if (psb_errstatus_fatal()) then
nc2l = prec%precv(level)%base_desc%get_local_cols()
info=psb_err_alloc_request_
@ -912,14 +912,14 @@ contains
do level = 1, nlev
call prec%precv(level)%free_wrk(info)
!write(0,*) 'Free at level ',level,': x2,y2,tx,ty'
call prec%wrk(level)%vx2l%free(info)
call prec%wrk(level)%vy2l%free(info)
call prec%wrk(level)%vtx%free(info)
call prec%wrk(level)%vty%free(info)
!write(0,*) 'Free at level ',level,': vw[123]'
do j=1,wv_size_
call prec%wrk(level)%wv(j)%free(info)
end do
!!$ call prec%wrk(level)%vx2l%free(info)
!!$ call prec%wrk(level)%vy2l%free(info)
!!$ call prec%wrk(level)%vtx%free(info)
!!$ call prec%wrk(level)%vty%free(info)
!!$ !write(0,*) 'Free at level ',level,': vw[123]'
!!$ do j=1,wv_size_
!!$ call prec%wrk(level)%wv(j)%free(info)
!!$ end do
!write(0,*) 'Free at level ',level,': done'
if (psb_errstatus_fatal()) then
info=psb_err_alloc_request_

@ -125,12 +125,17 @@ module mld_s_onelev_mod
type(psb_s_vect_type) :: vtx, vty, vx2l, vy2l
integer(psb_ipk_) :: wvsz = 0
type(psb_s_vect_type), allocatable :: wv(:)
contains
procedure, pass(wk) :: alloc => s_wrk_alloc
procedure, pass(wk) :: free => s_wrk_free
procedure, pass(wk) :: clone => s_wrk_clone
procedure, pass(wk) :: move_alloc => s_wrk_move_alloc
end type mld_smlprec_wrk_type
type mld_s_onelev_type
class(mld_s_base_smoother_type), allocatable :: sm, sm2a
class(mld_s_base_smoother_type), pointer :: sm2 => null()
type(mld_smlprec_wrk_type) :: wrk
class(mld_smlprec_wrk_type), allocatable :: wrk
type(mld_sml_parms) :: parms
type(psb_sspmat_type) :: ac
integer(psb_ipk_) :: ac_nz_loc, ac_nz_tot
@ -177,7 +182,8 @@ module mld_s_onelev_mod
private :: s_base_onelev_default, s_base_onelev_sizeof, &
& s_base_onelev_nullify, s_base_onelev_get_nzeros, &
& s_base_onelev_clone, s_base_onelev_move_alloc, &
& s_base_onelev_get_wrksize, s_base_onelev_allocate_wrk, s_base_onelev_free_wrk
& s_base_onelev_get_wrksize, s_base_onelev_allocate_wrk, &
& s_base_onelev_free_wrk
@ -586,44 +592,137 @@ contains
integer(psb_ipk_) :: nwv, i
info = psb_success_
nwv = lv%get_wrksz()
call psb_geasb(lv%wrk%vx2l,&
& lv%base_desc,info,&
if (.not.allocated(lv%wrk)) allocate(lv%wrk,stat=info)
if (info == 0) call lv%wrk%alloc(nwv,lv%base_desc,info,vmold=vmold)
end subroutine s_base_onelev_allocate_wrk
subroutine s_base_onelev_free_wrk(lv,info)
use psb_base_mod
implicit none
class(mld_s_onelev_type), target, intent(inout) :: lv
integer(psb_ipk_), intent(out) :: info
!
integer(psb_ipk_) :: nwv,i
info = psb_success_
call lv%wrk%free(info)
if (info == 0) deallocate(lv%wrk,stat=info)
end subroutine s_base_onelev_free_wrk
subroutine s_wrk_alloc(wk,nwv,desc,info,vmold)
use psb_base_mod
Implicit None
! Arguments
class(mld_smlprec_wrk_type), target, intent(inout) :: wk
integer(psb_ipk_), intent(in) :: nwv
type(psb_desc_type), intent(in) :: desc
integer(psb_ipk_), intent(out) :: info
class(psb_s_base_vect_type), intent(in), optional :: vmold
!
integer(psb_ipk_) :: i
info = psb_success_
call wk%free(info)
call psb_geasb(wk%vx2l,desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(lv%wrk%vy2l,&
& lv%base_desc,info,&
call psb_geasb(wk%vy2l,desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(lv%wrk%vtx,&
& lv%base_desc,info,&
call psb_geasb(wk%vtx,desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(lv%wrk%vty,&
& lv%base_desc,info,&
call psb_geasb(wk%vty,desc,info,&
& scratch=.true.,mold=vmold)
allocate(lv%wrk%wv(nwv),stat=info)
allocate(wk%wv(nwv),stat=info)
do i=1,nwv
call psb_geasb(lv%wrk%wv(i),&
& lv%base_desc,info,&
call psb_geasb(wk%wv(i),desc,info,&
& scratch=.true.,mold=vmold)
end do
end subroutine s_base_onelev_allocate_wrk
end subroutine s_wrk_alloc
subroutine s_base_onelev_free_wrk(lv,info)
subroutine s_wrk_free(wk,info)
Implicit None
! Arguments
class(mld_smlprec_wrk_type), target, intent(inout) :: wk
integer(psb_ipk_), intent(out) :: info
!
integer(psb_ipk_) :: i
info = psb_success_
if (allocated(wk%tx)) deallocate(wk%tx, stat=info)
if (allocated(wk%ty)) deallocate(wk%ty, stat=info)
if (allocated(wk%x2l)) deallocate(wk%x2l, stat=info)
if (allocated(wk%y2l)) deallocate(wk%y2l, stat=info)
call wk%vtx%free(info)
call wk%vty%free(info)
call wk%vx2l%free(info)
call wk%vy2l%free(info)
if (allocated(wk%wv)) then
do i=1,size(wk%wv)
call wk%wv(i)%free(info)
end do
deallocate(wk%wv, stat=info)
end if
end subroutine s_wrk_free
subroutine s_wrk_clone(wk,wkout,info)
use psb_base_mod
implicit none
class(mld_s_onelev_type), target, intent(inout) :: lv
Implicit None
! Arguments
class(mld_smlprec_wrk_type), target, intent(inout) :: wk
class(mld_smlprec_wrk_type), target, intent(inout) :: wkout
integer(psb_ipk_), intent(out) :: info
!
integer(psb_ipk_) :: nwv,i
integer(psb_ipk_) :: i
info = psb_success_
call lv%wrk%vx2l%free(info)
call lv%wrk%vy2l%free(info)
call lv%wrk%vtx%free(info)
call lv%wrk%vty%free(info)
nwv = size(lv%wrk%wv)
do i=1,nwv
call lv%wrk%wv(i)%free(info)
call psb_safe_ab_cpy(wk%tx,wkout%tx,info)
call psb_safe_ab_cpy(wk%ty,wkout%ty,info)
call psb_safe_ab_cpy(wk%x2l,wkout%x2l,info)
call psb_safe_ab_cpy(wk%y2l,wkout%y2l,info)
call wk%vtx%clone(wkout%vtx,info)
call wk%vty%clone(wkout%vty,info)
call wk%vx2l%clone(wkout%vx2l,info)
call wk%vy2l%clone(wkout%vy2l,info)
if (allocated(wkout%wv)) then
do i=1,size(wkout%wv)
call wkout%wv(i)%free(info)
end do
deallocate( wkout%wv)
end if
allocate(wkout%wv(size(wk%wv)),stat=info)
do i=1,size(wk%wv)
call wk%wv(i)%clone(wkout%wv(i),info)
end do
return
end subroutine s_base_onelev_free_wrk
end subroutine s_wrk_clone
subroutine s_wrk_move_alloc(wk, b,info)
implicit none
class(mld_smlprec_wrk_type), target, intent(inout) :: wk, b
integer(psb_ipk_), intent(out) :: info
call b%free(info)
call move_alloc(wk%tx,b%tx)
call move_alloc(wk%ty,b%ty)
call move_alloc(wk%x2l,b%x2l)
call move_alloc(wk%y2l,b%y2l)
!
! Should define V%move_alloc....
call move_alloc(wk%vtx%v,b%vtx%v)
call move_alloc(wk%vty%v,b%vty%v)
call move_alloc(wk%vx2l%v,b%vx2l%v)
call move_alloc(wk%vy2l%v,b%vy2l%v)
call move_alloc(wk%wv,b%wv)
end subroutine s_wrk_move_alloc
end module mld_s_onelev_mod

@ -852,24 +852,24 @@ contains
level = 1
do level = 1, nlev
call prec%precv(level)%allocate_wrk(info,vmold=vmold)
call psb_geasb(prec%wrk(level)%vx2l,&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(prec%wrk(level)%vy2l,&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(prec%wrk(level)%vtx,&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(prec%wrk(level)%vty,&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
allocate(prec%wrk(level)%wv(wv_size_),stat=info)
do j=1, wv_size_
call psb_geasb(prec%wrk(level)%wv(j),&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
end do
!!$ call psb_geasb(prec%wrk(level)%vx2l,&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ call psb_geasb(prec%wrk(level)%vy2l,&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ call psb_geasb(prec%wrk(level)%vtx,&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ call psb_geasb(prec%wrk(level)%vty,&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ allocate(prec%wrk(level)%wv(wv_size_),stat=info)
!!$ do j=1, wv_size_
!!$ call psb_geasb(prec%wrk(level)%wv(j),&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ end do
if (psb_errstatus_fatal()) then
nc2l = prec%precv(level)%base_desc%get_local_cols()
info=psb_err_alloc_request_
@ -912,14 +912,14 @@ contains
do level = 1, nlev
call prec%precv(level)%free_wrk(info)
!write(0,*) 'Free at level ',level,': x2,y2,tx,ty'
call prec%wrk(level)%vx2l%free(info)
call prec%wrk(level)%vy2l%free(info)
call prec%wrk(level)%vtx%free(info)
call prec%wrk(level)%vty%free(info)
!write(0,*) 'Free at level ',level,': vw[123]'
do j=1,wv_size_
call prec%wrk(level)%wv(j)%free(info)
end do
!!$ call prec%wrk(level)%vx2l%free(info)
!!$ call prec%wrk(level)%vy2l%free(info)
!!$ call prec%wrk(level)%vtx%free(info)
!!$ call prec%wrk(level)%vty%free(info)
!!$ !write(0,*) 'Free at level ',level,': vw[123]'
!!$ do j=1,wv_size_
!!$ call prec%wrk(level)%wv(j)%free(info)
!!$ end do
!write(0,*) 'Free at level ',level,': done'
if (psb_errstatus_fatal()) then
info=psb_err_alloc_request_

@ -125,12 +125,17 @@ module mld_z_onelev_mod
type(psb_z_vect_type) :: vtx, vty, vx2l, vy2l
integer(psb_ipk_) :: wvsz = 0
type(psb_z_vect_type), allocatable :: wv(:)
contains
procedure, pass(wk) :: alloc => z_wrk_alloc
procedure, pass(wk) :: free => z_wrk_free
procedure, pass(wk) :: clone => z_wrk_clone
procedure, pass(wk) :: move_alloc => z_wrk_move_alloc
end type mld_zmlprec_wrk_type
type mld_z_onelev_type
class(mld_z_base_smoother_type), allocatable :: sm, sm2a
class(mld_z_base_smoother_type), pointer :: sm2 => null()
type(mld_zmlprec_wrk_type) :: wrk
class(mld_zmlprec_wrk_type), allocatable :: wrk
type(mld_dml_parms) :: parms
type(psb_zspmat_type) :: ac
integer(psb_ipk_) :: ac_nz_loc, ac_nz_tot
@ -177,7 +182,8 @@ module mld_z_onelev_mod
private :: z_base_onelev_default, z_base_onelev_sizeof, &
& z_base_onelev_nullify, z_base_onelev_get_nzeros, &
& z_base_onelev_clone, z_base_onelev_move_alloc, &
& z_base_onelev_get_wrksize, z_base_onelev_allocate_wrk, z_base_onelev_free_wrk
& z_base_onelev_get_wrksize, z_base_onelev_allocate_wrk, &
& z_base_onelev_free_wrk
@ -586,44 +592,137 @@ contains
integer(psb_ipk_) :: nwv, i
info = psb_success_
nwv = lv%get_wrksz()
call psb_geasb(lv%wrk%vx2l,&
& lv%base_desc,info,&
if (.not.allocated(lv%wrk)) allocate(lv%wrk,stat=info)
if (info == 0) call lv%wrk%alloc(nwv,lv%base_desc,info,vmold=vmold)
end subroutine z_base_onelev_allocate_wrk
subroutine z_base_onelev_free_wrk(lv,info)
use psb_base_mod
implicit none
class(mld_z_onelev_type), target, intent(inout) :: lv
integer(psb_ipk_), intent(out) :: info
!
integer(psb_ipk_) :: nwv,i
info = psb_success_
call lv%wrk%free(info)
if (info == 0) deallocate(lv%wrk,stat=info)
end subroutine z_base_onelev_free_wrk
subroutine z_wrk_alloc(wk,nwv,desc,info,vmold)
use psb_base_mod
Implicit None
! Arguments
class(mld_zmlprec_wrk_type), target, intent(inout) :: wk
integer(psb_ipk_), intent(in) :: nwv
type(psb_desc_type), intent(in) :: desc
integer(psb_ipk_), intent(out) :: info
class(psb_z_base_vect_type), intent(in), optional :: vmold
!
integer(psb_ipk_) :: i
info = psb_success_
call wk%free(info)
call psb_geasb(wk%vx2l,desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(lv%wrk%vy2l,&
& lv%base_desc,info,&
call psb_geasb(wk%vy2l,desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(lv%wrk%vtx,&
& lv%base_desc,info,&
call psb_geasb(wk%vtx,desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(lv%wrk%vty,&
& lv%base_desc,info,&
call psb_geasb(wk%vty,desc,info,&
& scratch=.true.,mold=vmold)
allocate(lv%wrk%wv(nwv),stat=info)
allocate(wk%wv(nwv),stat=info)
do i=1,nwv
call psb_geasb(lv%wrk%wv(i),&
& lv%base_desc,info,&
call psb_geasb(wk%wv(i),desc,info,&
& scratch=.true.,mold=vmold)
end do
end subroutine z_base_onelev_allocate_wrk
end subroutine z_wrk_alloc
subroutine z_base_onelev_free_wrk(lv,info)
subroutine z_wrk_free(wk,info)
Implicit None
! Arguments
class(mld_zmlprec_wrk_type), target, intent(inout) :: wk
integer(psb_ipk_), intent(out) :: info
!
integer(psb_ipk_) :: i
info = psb_success_
if (allocated(wk%tx)) deallocate(wk%tx, stat=info)
if (allocated(wk%ty)) deallocate(wk%ty, stat=info)
if (allocated(wk%x2l)) deallocate(wk%x2l, stat=info)
if (allocated(wk%y2l)) deallocate(wk%y2l, stat=info)
call wk%vtx%free(info)
call wk%vty%free(info)
call wk%vx2l%free(info)
call wk%vy2l%free(info)
if (allocated(wk%wv)) then
do i=1,size(wk%wv)
call wk%wv(i)%free(info)
end do
deallocate(wk%wv, stat=info)
end if
end subroutine z_wrk_free
subroutine z_wrk_clone(wk,wkout,info)
use psb_base_mod
implicit none
class(mld_z_onelev_type), target, intent(inout) :: lv
Implicit None
! Arguments
class(mld_zmlprec_wrk_type), target, intent(inout) :: wk
class(mld_zmlprec_wrk_type), target, intent(inout) :: wkout
integer(psb_ipk_), intent(out) :: info
!
integer(psb_ipk_) :: nwv,i
integer(psb_ipk_) :: i
info = psb_success_
call lv%wrk%vx2l%free(info)
call lv%wrk%vy2l%free(info)
call lv%wrk%vtx%free(info)
call lv%wrk%vty%free(info)
nwv = size(lv%wrk%wv)
do i=1,nwv
call lv%wrk%wv(i)%free(info)
call psb_safe_ab_cpy(wk%tx,wkout%tx,info)
call psb_safe_ab_cpy(wk%ty,wkout%ty,info)
call psb_safe_ab_cpy(wk%x2l,wkout%x2l,info)
call psb_safe_ab_cpy(wk%y2l,wkout%y2l,info)
call wk%vtx%clone(wkout%vtx,info)
call wk%vty%clone(wkout%vty,info)
call wk%vx2l%clone(wkout%vx2l,info)
call wk%vy2l%clone(wkout%vy2l,info)
if (allocated(wkout%wv)) then
do i=1,size(wkout%wv)
call wkout%wv(i)%free(info)
end do
deallocate( wkout%wv)
end if
allocate(wkout%wv(size(wk%wv)),stat=info)
do i=1,size(wk%wv)
call wk%wv(i)%clone(wkout%wv(i),info)
end do
return
end subroutine z_base_onelev_free_wrk
end subroutine z_wrk_clone
subroutine z_wrk_move_alloc(wk, b,info)
implicit none
class(mld_zmlprec_wrk_type), target, intent(inout) :: wk, b
integer(psb_ipk_), intent(out) :: info
call b%free(info)
call move_alloc(wk%tx,b%tx)
call move_alloc(wk%ty,b%ty)
call move_alloc(wk%x2l,b%x2l)
call move_alloc(wk%y2l,b%y2l)
!
! Should define V%move_alloc....
call move_alloc(wk%vtx%v,b%vtx%v)
call move_alloc(wk%vty%v,b%vty%v)
call move_alloc(wk%vx2l%v,b%vx2l%v)
call move_alloc(wk%vy2l%v,b%vy2l%v)
call move_alloc(wk%wv,b%wv)
end subroutine z_wrk_move_alloc
end module mld_z_onelev_mod

@ -852,24 +852,24 @@ contains
level = 1
do level = 1, nlev
call prec%precv(level)%allocate_wrk(info,vmold=vmold)
call psb_geasb(prec%wrk(level)%vx2l,&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(prec%wrk(level)%vy2l,&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(prec%wrk(level)%vtx,&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
call psb_geasb(prec%wrk(level)%vty,&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
allocate(prec%wrk(level)%wv(wv_size_),stat=info)
do j=1, wv_size_
call psb_geasb(prec%wrk(level)%wv(j),&
& prec%precv(level)%base_desc,info,&
& scratch=.true.,mold=vmold)
end do
!!$ call psb_geasb(prec%wrk(level)%vx2l,&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ call psb_geasb(prec%wrk(level)%vy2l,&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ call psb_geasb(prec%wrk(level)%vtx,&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ call psb_geasb(prec%wrk(level)%vty,&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ allocate(prec%wrk(level)%wv(wv_size_),stat=info)
!!$ do j=1, wv_size_
!!$ call psb_geasb(prec%wrk(level)%wv(j),&
!!$ & prec%precv(level)%base_desc,info,&
!!$ & scratch=.true.,mold=vmold)
!!$ end do
if (psb_errstatus_fatal()) then
nc2l = prec%precv(level)%base_desc%get_local_cols()
info=psb_err_alloc_request_
@ -912,14 +912,14 @@ contains
do level = 1, nlev
call prec%precv(level)%free_wrk(info)
!write(0,*) 'Free at level ',level,': x2,y2,tx,ty'
call prec%wrk(level)%vx2l%free(info)
call prec%wrk(level)%vy2l%free(info)
call prec%wrk(level)%vtx%free(info)
call prec%wrk(level)%vty%free(info)
!write(0,*) 'Free at level ',level,': vw[123]'
do j=1,wv_size_
call prec%wrk(level)%wv(j)%free(info)
end do
!!$ call prec%wrk(level)%vx2l%free(info)
!!$ call prec%wrk(level)%vy2l%free(info)
!!$ call prec%wrk(level)%vtx%free(info)
!!$ call prec%wrk(level)%vty%free(info)
!!$ !write(0,*) 'Free at level ',level,': vw[123]'
!!$ do j=1,wv_size_
!!$ call prec%wrk(level)%wv(j)%free(info)
!!$ end do
!write(0,*) 'Free at level ',level,': done'
if (psb_errstatus_fatal()) then
info=psb_err_alloc_request_

Loading…
Cancel
Save