*** empty log message ***

psblas3-submodules
Salvatore Filippone 11 years ago
parent 16b9bbea47
commit 4102452f53

@ -42,105 +42,107 @@
! desc_a - type(psb_desc_type). The communication descriptor. ! desc_a - type(psb_desc_type). The communication descriptor.
! info - integer. return code. ! info - integer. return code.
! !
subroutine psi_crea_ovr_elem(me,desc_overlap,ovr_elem,info) submodule (psi_i_mod) psi_crea_ovr_elem_impl_mod
contains
use psi_mod, psb_protect_name => psi_crea_ovr_elem subroutine psi_crea_ovr_elem(me,desc_overlap,ovr_elem,info)
use psb_realloc_mod
use psb_error_mod use psb_realloc_mod
use psb_penv_mod use psb_error_mod
use psb_serial_mod use psb_penv_mod
implicit none use psb_serial_mod
implicit none
! ...parameter arrays....
integer(psb_ipk_), intent(in) :: me, desc_overlap(:) ! ...parameter arrays....
integer(psb_ipk_), allocatable, intent(out) :: ovr_elem(:,:) integer(psb_ipk_), intent(in) :: me, desc_overlap(:)
integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), allocatable, intent(out) :: ovr_elem(:,:)
integer(psb_ipk_), intent(out) :: info
! ...local scalars...
integer(psb_ipk_) :: i,pnt_new_elem,ret,j ! ...local scalars...
integer(psb_ipk_) :: dim_ovr_elem integer(psb_ipk_) :: i,pnt_new_elem,ret,j
integer(psb_ipk_) :: pairtree(2) integer(psb_ipk_) :: dim_ovr_elem
integer(psb_ipk_) :: pairtree(2)
! ...external function...
integer(psb_ipk_) :: psi_exist_ovr_elem ! ...external function...
external :: psi_exist_ovr_elem integer(psb_ipk_) :: psi_exist_ovr_elem
external :: psi_exist_ovr_elem
integer(psb_ipk_) :: nel, ip, ix, iel, insize, err_act, iproc
integer(psb_ipk_), allocatable :: telem(:,:) integer(psb_ipk_) :: nel, ip, ix, iel, insize, err_act, iproc
integer(psb_ipk_), allocatable :: telem(:,:)
character(len=20) :: name
character(len=20) :: name
info = psb_success_
name='psi_crea_ovr_elem' info = psb_success_
name='psi_crea_ovr_elem'
if (allocated(ovr_elem)) then
dim_ovr_elem = size(ovr_elem,1) if (allocated(ovr_elem)) then
else dim_ovr_elem = size(ovr_elem,1)
dim_ovr_elem = 0 else
endif dim_ovr_elem = 0
endif
insize = size(desc_overlap)
insize = max(1,(insize+1)/2) insize = size(desc_overlap)
allocate(telem(insize,3),stat=info) insize = max(1,(insize+1)/2)
if (info /= psb_success_) then allocate(telem(insize,3),stat=info)
info = psb_err_alloc_dealloc_ if (info /= psb_success_) then
call psb_errpush(info,name) info = psb_err_alloc_dealloc_
goto 9999 call psb_errpush(info,name)
endif goto 9999
i = 1 endif
nel = 0 i = 1
do while (desc_overlap(i) /= -1) nel = 0
! ...loop over all procs of desc_overlap list.... do while (desc_overlap(i) /= -1)
iproc = desc_overlap(i) ! ...loop over all procs of desc_overlap list....
i = i+1 iproc = desc_overlap(i)
do j=1,desc_overlap(i) i = i+1
nel = nel + 1 do j=1,desc_overlap(i)
telem(nel,1) = desc_overlap(i+j) nel = nel + 1
telem(nel,2) = 1 telem(nel,1) = desc_overlap(i+j)
telem(nel,3) = iproc telem(nel,2) = 1
telem(nel,3) = iproc
enddo
i=i+2*desc_overlap(i)+2
enddo enddo
i=i+2*desc_overlap(i)+2
enddo if (nel > 0) then
call psb_msort(telem(1:nel,1),ix=telem(1:nel,3),flag=psb_sort_keep_idx_)
if (nel > 0) then
call psb_msort(telem(1:nel,1),ix=telem(1:nel,3),flag=psb_sort_keep_idx_) iel = telem(1,1)
telem(1,2) = 2
iel = telem(1,1) telem(1,3) = min(me,telem(1,3))
telem(1,2) = 2 ix = 1
telem(1,3) = min(me,telem(1,3)) ip = 2
ix = 1 do
ip = 2 if (ip > nel) exit
do if (telem(ip,1) == iel) then
if (ip > nel) exit telem(ix,2) = telem(ix,2) + 1
if (telem(ip,1) == iel) then telem(ix,3) = min(telem(ix,3),telem(ip,3))
telem(ix,2) = telem(ix,2) + 1 else
telem(ix,3) = min(telem(ix,3),telem(ip,3)) ix = ix + 1
else telem(ix,1) = telem(ip,1)
ix = ix + 1 iel = telem(ip,1)
telem(ix,1) = telem(ip,1) telem(ix,2) = 2
iel = telem(ip,1) telem(ix,3) = min(me,telem(ip,3))
telem(ix,2) = 2 end if
telem(ix,3) = min(me,telem(ip,3)) ip = ip + 1
end if end do
ip = ip + 1 else
end do ix = 0
else end if
ix = 0
end if nel = ix
nel = ix call psb_realloc(nel,3,telem,info)
call psb_move_alloc(telem,ovr_elem,info)
call psb_realloc(nel,3,telem,info)
call psb_move_alloc(telem,ovr_elem,info) call psb_erractionrestore(err_act)
return
call psb_erractionrestore(err_act)
return
9999 call psb_error_handler(err_act) 9999 call psb_error_handler(err_act)
return return
end subroutine psi_crea_ovr_elem end subroutine psi_crea_ovr_elem
end submodule psi_crea_ovr_elem_impl_mod

Loading…
Cancel
Save