diff --git a/base/modules/auxil/psb_hash_mod.f90 b/base/modules/auxil/psb_hash_mod.f90 index b6a2210c..1fd433b0 100644 --- a/base/modules/auxil/psb_hash_mod.f90 +++ b/base/modules/auxil/psb_hash_mod.f90 @@ -83,6 +83,10 @@ module psb_hash_mod module procedure psb_hash_searchinskey, psb_hash_lsearchinskey end interface psb_hash_searchinskey + interface psb_hash_searchkey + module procedure psb_hash_searchkey, psb_hash_lsearchkey + end interface psb_hash_searchkey + interface psb_move_alloc module procedure HashTransfer end interface @@ -535,4 +539,44 @@ contains end do end subroutine psb_hash_searchkey + subroutine psb_hash_lsearchkey(key,val,hash,info) + integer(psb_lpk_), intent(in) :: key + type(psb_hash_type) :: hash + integer(psb_lpk_), intent(out) :: val + integer(psb_ipk_), intent(out) :: info + + integer(psb_ipk_) :: hsize,hmask, hk, hd + + info = HashOK + if (.not.allocated(hash%table) ) then + val = HashFreeEntry + return + end if + hsize = hash%hsize + hmask = hash%hmask + hk = iand(hashval(key),hmask) + if (hk == 0) then + hd = 1 + else + hd = hsize - hk + hd = ior(hd,1) + end if + + hash%nsrch = hash%nsrch + 1 + do + hash%nacc = hash%nacc + 1 + if (hash%table(hk,1) == key) then + val = hash%table(hk,2) + return + end if + if (hash%table(hk,1) == HashFreeEntry) then + val = HashFreeEntry +! !$ info = HashNotFound + return + end if + hk = hk - hd + if (hk < 0) hk = hk + hsize + end do + end subroutine psb_hash_lsearchkey + end module psb_hash_mod diff --git a/base/modules/desc/psb_gen_block_map_mod.f90 b/base/modules/desc/psb_gen_block_map_mod.f90 index 41615e8d..dc9e5510 100644 --- a/base/modules/desc/psb_gen_block_map_mod.f90 +++ b/base/modules/desc/psb_gen_block_map_mod.f90 @@ -67,30 +67,30 @@ module psb_gen_block_map_mod procedure, pass(idxmap) :: reinit => block_reinit procedure, nopass :: get_fmt => block_get_fmt - procedure, pass(idxmap) :: l2gs1 => block_l2gs1 - procedure, pass(idxmap) :: l2gs2 => block_l2gs2 - procedure, pass(idxmap) :: l2gv1 => block_l2gv1 - procedure, pass(idxmap) :: l2gv2 => block_l2gv2 +!!$ procedure, pass(idxmap) :: l2gs1 => block_l2gs1 +!!$ procedure, pass(idxmap) :: l2gs2 => block_l2gs2 +!!$ procedure, pass(idxmap) :: l2gv1 => block_l2gv1 +!!$ procedure, pass(idxmap) :: l2gv2 => block_l2gv2 procedure, pass(idxmap) :: ll2gs1 => block_ll2gs1 procedure, pass(idxmap) :: ll2gs2 => block_ll2gs2 procedure, pass(idxmap) :: ll2gv1 => block_ll2gv1 procedure, pass(idxmap) :: ll2gv2 => block_ll2gv2 - procedure, pass(idxmap) :: g2ls1 => block_g2ls1 - procedure, pass(idxmap) :: g2ls2 => block_g2ls2 - procedure, pass(idxmap) :: g2lv1 => block_g2lv1 - procedure, pass(idxmap) :: g2lv2 => block_g2lv2 +!!$ procedure, pass(idxmap) :: g2ls1 => block_g2ls1 +!!$ procedure, pass(idxmap) :: g2ls2 => block_g2ls2 +!!$ procedure, pass(idxmap) :: g2lv1 => block_g2lv1 +!!$ procedure, pass(idxmap) :: g2lv2 => block_g2lv2 procedure, pass(idxmap) :: lg2ls1 => block_lg2ls1 procedure, pass(idxmap) :: lg2ls2 => block_lg2ls2 procedure, pass(idxmap) :: lg2lv1 => block_lg2lv1 procedure, pass(idxmap) :: lg2lv2 => block_lg2lv2 - procedure, pass(idxmap) :: g2ls1_ins => block_g2ls1_ins - procedure, pass(idxmap) :: g2ls2_ins => block_g2ls2_ins - procedure, pass(idxmap) :: g2lv1_ins => block_g2lv1_ins - procedure, pass(idxmap) :: g2lv2_ins => block_g2lv2_ins +!!$ procedure, pass(idxmap) :: g2ls1_ins => block_g2ls1_ins +!!$ procedure, pass(idxmap) :: g2ls2_ins => block_g2ls2_ins +!!$ procedure, pass(idxmap) :: g2lv1_ins => block_g2lv1_ins +!!$ procedure, pass(idxmap) :: g2lv2_ins => block_g2lv2_ins procedure, pass(idxmap) :: lg2ls1_ins => block_lg2ls1_ins procedure, pass(idxmap) :: lg2ls2_ins => block_lg2ls2_ins @@ -152,164 +152,164 @@ contains end subroutine block_free - - subroutine block_l2gs1(idx,idxmap,info,mask,owned) - implicit none - class(psb_gen_block_map), intent(in) :: idxmap - integer(psb_ipk_), intent(inout) :: idx - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask - logical, intent(in), optional :: owned - integer(psb_ipk_) :: idxv(1) - info = 0 - if (present(mask)) then - if (.not.mask) return - end if - - idxv(1) = idx - call idxmap%l2gip(idxv,info,owned=owned) - idx = idxv(1) - - end subroutine block_l2gs1 - - subroutine block_l2gs2(idxin,idxout,idxmap,info,mask,owned) - implicit none - class(psb_gen_block_map), intent(in) :: idxmap - integer(psb_ipk_), intent(in) :: idxin - integer(psb_ipk_), intent(out) :: idxout - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask - logical, intent(in), optional :: owned - - idxout = idxin - call idxmap%l2gip(idxout,info,mask,owned) - - end subroutine block_l2gs2 - - - subroutine block_l2gv1(idx,idxmap,info,mask,owned) - implicit none - class(psb_gen_block_map), intent(in) :: idxmap - integer(psb_ipk_), intent(inout) :: idx(:) - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask(:) - logical, intent(in), optional :: owned - integer(psb_ipk_) :: i - logical :: owned_ - info = 0 - - if (present(mask)) then - if (size(mask) < size(idx)) then - info = -1 - return - end if - end if - if (present(owned)) then - owned_ = owned - else - owned_ = .false. - end if - - if (present(mask)) then - - do i=1, size(idx) - if (mask(i)) then - if ((1<=idx(i)).and.(idx(i) <= idxmap%local_rows)) then - idx(i) = idxmap%min_glob_row + idx(i) - 1 - else if ((idxmap%local_rows < idx(i)).and.(idx(i) <= idxmap%local_cols)& - & .and.(.not.owned_)) then - idx(i) = idxmap%loc_to_glob(idx(i)-idxmap%local_rows) - else - idx(i) = -1 - info = -1 - end if - end if - end do - - else if (.not.present(mask)) then - - do i=1, size(idx) - if ((1<=idx(i)).and.(idx(i) <= idxmap%local_rows)) then - idx(i) = idxmap%min_glob_row + idx(i) - 1 - else if ((idxmap%local_rows < idx(i)).and.(idx(i) <= idxmap%local_cols)& - & .and.(.not.owned_)) then - idx(i) = idxmap%loc_to_glob(idx(i)-idxmap%local_rows) - else - idx(i) = -1 - info = -1 - end if - end do - - end if - - end subroutine block_l2gv1 - - subroutine block_l2gv2(idxin,idxout,idxmap,info,mask,owned) - implicit none - class(psb_gen_block_map), intent(in) :: idxmap - integer(psb_ipk_), intent(in) :: idxin(:) - integer(psb_ipk_), intent(out) :: idxout(:) - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask(:) - logical, intent(in), optional :: owned - integer(psb_ipk_) :: is, im, i - logical :: owned_ - - info = 0 - - is = size(idxin) - im = min(is,size(idxout)) - - if (present(mask)) then - if (size(mask) < im) then - info = -1 - return - end if - end if - if (present(owned)) then - owned_ = owned - else - owned_ = .false. - end if - - if (present(mask)) then - - do i=1, im - if (mask(i)) then - if ((1<=idxin(i)).and.(idxin(i) <= idxmap%local_rows)) then - idxout(i) = idxmap%min_glob_row + idxin(i) - 1 - else if ((idxmap%local_rows < idxin(i)).and.(idxin(i) <= idxmap%local_cols)& - & .and.(.not.owned_)) then - idxout(i) = idxmap%loc_to_glob(idxin(i)-idxmap%local_rows) - else - idxout(i) = -1 - info = -1 - end if - end if - end do - - else if (.not.present(mask)) then - - do i=1, im - if ((1<=idxin(i)).and.(idxin(i) <= idxmap%local_rows)) then - idxout(i) = idxmap%min_glob_row + idxin(i) - 1 - else if ((idxmap%local_rows < idxin(i)).and.(idxin(i) <= idxmap%local_cols)& - & .and.(.not.owned_)) then - idxout(i) = idxmap%loc_to_glob(idxin(i)-idxmap%local_rows) - else - idxout(i) = -1 - info = -1 - end if - end do - - end if - - if (is > im) then - info = -3 - end if - - end subroutine block_l2gv2 - +!!$ +!!$ subroutine block_l2gs1(idx,idxmap,info,mask,owned) +!!$ implicit none +!!$ class(psb_gen_block_map), intent(in) :: idxmap +!!$ integer(psb_ipk_), intent(inout) :: idx +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask +!!$ logical, intent(in), optional :: owned +!!$ integer(psb_ipk_) :: idxv(1) +!!$ info = 0 +!!$ if (present(mask)) then +!!$ if (.not.mask) return +!!$ end if +!!$ +!!$ idxv(1) = idx +!!$ call idxmap%l2gip(idxv,info,owned=owned) +!!$ idx = idxv(1) +!!$ +!!$ end subroutine block_l2gs1 +!!$ +!!$ subroutine block_l2gs2(idxin,idxout,idxmap,info,mask,owned) +!!$ implicit none +!!$ class(psb_gen_block_map), intent(in) :: idxmap +!!$ integer(psb_ipk_), intent(in) :: idxin +!!$ integer(psb_ipk_), intent(out) :: idxout +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask +!!$ logical, intent(in), optional :: owned +!!$ +!!$ idxout = idxin +!!$ call idxmap%l2gip(idxout,info,mask,owned) +!!$ +!!$ end subroutine block_l2gs2 +!!$ +!!$ +!!$ subroutine block_l2gv1(idx,idxmap,info,mask,owned) +!!$ implicit none +!!$ class(psb_gen_block_map), intent(in) :: idxmap +!!$ integer(psb_ipk_), intent(inout) :: idx(:) +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask(:) +!!$ logical, intent(in), optional :: owned +!!$ integer(psb_ipk_) :: i +!!$ logical :: owned_ +!!$ info = 0 +!!$ +!!$ if (present(mask)) then +!!$ if (size(mask) < size(idx)) then +!!$ info = -1 +!!$ return +!!$ end if +!!$ end if +!!$ if (present(owned)) then +!!$ owned_ = owned +!!$ else +!!$ owned_ = .false. +!!$ end if +!!$ +!!$ if (present(mask)) then +!!$ +!!$ do i=1, size(idx) +!!$ if (mask(i)) then +!!$ if ((1<=idx(i)).and.(idx(i) <= idxmap%local_rows)) then +!!$ idx(i) = idxmap%min_glob_row + idx(i) - 1 +!!$ else if ((idxmap%local_rows < idx(i)).and.(idx(i) <= idxmap%local_cols)& +!!$ & .and.(.not.owned_)) then +!!$ idx(i) = idxmap%loc_to_glob(idx(i)-idxmap%local_rows) +!!$ else +!!$ idx(i) = -1 +!!$ info = -1 +!!$ end if +!!$ end if +!!$ end do +!!$ +!!$ else if (.not.present(mask)) then +!!$ +!!$ do i=1, size(idx) +!!$ if ((1<=idx(i)).and.(idx(i) <= idxmap%local_rows)) then +!!$ idx(i) = idxmap%min_glob_row + idx(i) - 1 +!!$ else if ((idxmap%local_rows < idx(i)).and.(idx(i) <= idxmap%local_cols)& +!!$ & .and.(.not.owned_)) then +!!$ idx(i) = idxmap%loc_to_glob(idx(i)-idxmap%local_rows) +!!$ else +!!$ idx(i) = -1 +!!$ info = -1 +!!$ end if +!!$ end do +!!$ +!!$ end if +!!$ +!!$ end subroutine block_l2gv1 +!!$ +!!$ subroutine block_l2gv2(idxin,idxout,idxmap,info,mask,owned) +!!$ implicit none +!!$ class(psb_gen_block_map), intent(in) :: idxmap +!!$ integer(psb_ipk_), intent(in) :: idxin(:) +!!$ integer(psb_ipk_), intent(out) :: idxout(:) +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask(:) +!!$ logical, intent(in), optional :: owned +!!$ integer(psb_ipk_) :: is, im, i +!!$ logical :: owned_ +!!$ +!!$ info = 0 +!!$ +!!$ is = size(idxin) +!!$ im = min(is,size(idxout)) +!!$ +!!$ if (present(mask)) then +!!$ if (size(mask) < im) then +!!$ info = -1 +!!$ return +!!$ end if +!!$ end if +!!$ if (present(owned)) then +!!$ owned_ = owned +!!$ else +!!$ owned_ = .false. +!!$ end if +!!$ +!!$ if (present(mask)) then +!!$ +!!$ do i=1, im +!!$ if (mask(i)) then +!!$ if ((1<=idxin(i)).and.(idxin(i) <= idxmap%local_rows)) then +!!$ idxout(i) = idxmap%min_glob_row + idxin(i) - 1 +!!$ else if ((idxmap%local_rows < idxin(i)).and.(idxin(i) <= idxmap%local_cols)& +!!$ & .and.(.not.owned_)) then +!!$ idxout(i) = idxmap%loc_to_glob(idxin(i)-idxmap%local_rows) +!!$ else +!!$ idxout(i) = -1 +!!$ info = -1 +!!$ end if +!!$ end if +!!$ end do +!!$ +!!$ else if (.not.present(mask)) then +!!$ +!!$ do i=1, im +!!$ if ((1<=idxin(i)).and.(idxin(i) <= idxmap%local_rows)) then +!!$ idxout(i) = idxmap%min_glob_row + idxin(i) - 1 +!!$ else if ((idxmap%local_rows < idxin(i)).and.(idxin(i) <= idxmap%local_cols)& +!!$ & .and.(.not.owned_)) then +!!$ idxout(i) = idxmap%loc_to_glob(idxin(i)-idxmap%local_rows) +!!$ else +!!$ idxout(i) = -1 +!!$ info = -1 +!!$ end if +!!$ end do +!!$ +!!$ end if +!!$ +!!$ if (is > im) then +!!$ info = -3 +!!$ end if +!!$ +!!$ end subroutine block_l2gv2 +!!$ subroutine block_ll2gs1(idx,idxmap,info,mask,owned) implicit none @@ -468,15 +468,277 @@ contains end subroutine block_ll2gv2 +!!$ subroutine block_g2ls1(idx,idxmap,info,mask,owned) +!!$ implicit none +!!$ class(psb_gen_block_map), intent(in) :: idxmap +!!$ integer(psb_ipk_), intent(inout) :: idx +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask +!!$ logical, intent(in), optional :: owned +!!$ integer(psb_ipk_) :: idxv(1) +!!$ info = 0 +!!$ +!!$ if (present(mask)) then +!!$ if (.not.mask) return +!!$ end if +!!$ +!!$ idxv(1) = idx +!!$ call idxmap%g2lip(idxv,info,owned=owned) +!!$ idx = idxv(1) +!!$ +!!$ end subroutine block_g2ls1 +!!$ +!!$ subroutine block_g2ls2(idxin,idxout,idxmap,info,mask,owned) +!!$ implicit none +!!$ class(psb_gen_block_map), intent(in) :: idxmap +!!$ integer(psb_ipk_), intent(in) :: idxin +!!$ integer(psb_ipk_), intent(out) :: idxout +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask +!!$ logical, intent(in), optional :: owned +!!$ +!!$ idxout = idxin +!!$ call idxmap%g2lip(idxout,info,mask,owned) +!!$ +!!$ end subroutine block_g2ls2 +!!$ +!!$ +!!$ subroutine block_g2lv1(idx,idxmap,info,mask,owned) +!!$ use psb_penv_mod +!!$ use psb_sort_mod +!!$ implicit none +!!$ class(psb_gen_block_map), intent(in) :: idxmap +!!$ integer(psb_ipk_), intent(inout) :: idx(:) +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask(:) +!!$ logical, intent(in), optional :: owned +!!$ integer(psb_ipk_) :: i, nv, is, ip, lip +!!$ integer(psb_lpk_) :: tidx +!!$ integer(psb_mpk_) :: ictxt, iam, np +!!$ logical :: owned_ +!!$ +!!$ info = 0 +!!$ ictxt = idxmap%get_ctxt() +!!$ call psb_info(ictxt,iam,np) +!!$ +!!$ if (present(mask)) then +!!$ if (size(mask) < size(idx)) then +!!$! !$ write(0,*) 'Block g2l: size of mask', size(mask),size(idx) +!!$ info = -1 +!!$ return +!!$ end if +!!$ end if +!!$ if (present(owned)) then +!!$ owned_ = owned +!!$ else +!!$ owned_ = .false. +!!$ end if +!!$ +!!$ is = size(idx) +!!$ if (present(mask)) then +!!$ +!!$ if (idxmap%is_asb()) then +!!$ do i=1, is +!!$ if (mask(i)) then +!!$ if ((idxmap%min_glob_row <= idx(i)).and.(idx(i) <= idxmap%max_glob_row)) then +!!$ idx(i) = idx(i) - idxmap%min_glob_row + 1 +!!$ else if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)& +!!$ &.and.(.not.owned_)) then +!!$ nv = size(idxmap%srt_l2g,1) +!!$ tidx = idx(i) +!!$ idx(i) = psb_bsrch(tidx,nv,idxmap%srt_l2g(:,1)) +!!$ if (idx(i) > 0) idx(i) = idxmap%srt_l2g(idx(i),2)+idxmap%local_rows +!!$ else +!!$ idx(i) = -1 +!!$ end if +!!$ end if +!!$ end do +!!$ else if (idxmap%is_valid()) then +!!$ do i=1,is +!!$ if (mask(i)) then +!!$ if ((idxmap%min_glob_row <= idx(i)).and.(idx(i) <= idxmap%max_glob_row)) then +!!$ idx(i) = idx(i) - idxmap%min_glob_row + 1 +!!$ else if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)& +!!$ &.and.(.not.owned_)) then +!!$ ip = idx(i) +!!$ call psb_hash_searchkey(ip,lip,idxmap%hash,info) +!!$ if (lip > 0) idx(i) = lip + idxmap%local_rows +!!$ else +!!$ idx(i) = -1 +!!$ end if +!!$ end if +!!$ end do +!!$ else +!!$! !$ write(0,*) 'Block status: invalid ',idxmap%get_state() +!!$ idx(1:is) = -1 +!!$ info = -1 +!!$ end if +!!$ +!!$ else if (.not.present(mask)) then +!!$ +!!$ if (idxmap%is_asb()) then +!!$ do i=1, is +!!$ if ((idxmap%min_glob_row <= idx(i)).and.(idx(i) <= idxmap%max_glob_row)) then +!!$ idx(i) = idx(i) - idxmap%min_glob_row + 1 +!!$ else if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)& +!!$ &.and.(.not.owned_)) then +!!$ nv = size(idxmap%srt_l2g,1) +!!$ tidx = idx(i) +!!$ idx(i) = psb_bsrch(tidx,nv,idxmap%srt_l2g(:,1)) +!!$ if (idx(i) > 0) idx(i) = idxmap%srt_l2g(idx(i),2)+idxmap%local_rows +!!$ else +!!$ idx(i) = -1 +!!$ end if +!!$ end do +!!$ +!!$ else if (idxmap%is_valid()) then +!!$ do i=1,is +!!$ if ((idxmap%min_glob_row <= idx(i)).and.(idx(i) <= idxmap%max_glob_row)) then +!!$ idx(i) = idx(i) - idxmap%min_glob_row + 1 +!!$ else if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)& +!!$ &.and.(.not.owned_)) then +!!$ ip = idx(i) +!!$ call psb_hash_searchkey(ip,lip,idxmap%hash,info) +!!$ if (lip > 0) idx(i) = lip + idxmap%local_rows +!!$ else +!!$ idx(i) = -1 +!!$ end if +!!$ end do +!!$ else +!!$! !$ write(0,*) 'Block status: invalid ',idxmap%get_state() +!!$ idx(1:is) = -1 +!!$ info = -1 +!!$ end if +!!$ +!!$ end if +!!$ +!!$ end subroutine block_g2lv1 +!!$ +!!$ subroutine block_g2lv2(idxin,idxout,idxmap,info,mask,owned) +!!$ use psb_penv_mod +!!$ use psb_sort_mod +!!$ implicit none +!!$ class(psb_gen_block_map), intent(in) :: idxmap +!!$ integer(psb_ipk_), intent(in) :: idxin(:) +!!$ integer(psb_ipk_), intent(out) :: idxout(:) +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask(:) +!!$ logical, intent(in), optional :: owned +!!$ +!!$ integer(psb_ipk_) :: i, nv, is, ip, lip, im +!!$ integer(psb_lpk_) :: tidx +!!$ integer(psb_mpk_) :: ictxt, iam, np +!!$ logical :: owned_ +!!$ +!!$ info = 0 +!!$ ictxt = idxmap%get_ctxt() +!!$ call psb_info(ictxt,iam,np) +!!$ is = size(idxin) +!!$ im = min(is,size(idxout)) +!!$ +!!$ if (present(mask)) then +!!$ if (size(mask) < im) then +!!$! !$ write(0,*) 'Block g2l: size of mask', size(mask),size(idx) +!!$ info = -1 +!!$ return +!!$ end if +!!$ end if +!!$ if (present(owned)) then +!!$ owned_ = owned +!!$ else +!!$ owned_ = .false. +!!$ end if +!!$ +!!$ if (present(mask)) then +!!$ +!!$ if (idxmap%is_asb()) then +!!$ do i=1, im +!!$ if (mask(i)) then +!!$ if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then +!!$ idxout(i) = idxin(i) - idxmap%min_glob_row + 1 +!!$ else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)& +!!$ &.and.(.not.owned_)) then +!!$ nv = size(idxmap%srt_l2g,1) +!!$ tidx = idxin(i) +!!$ idxout(i) = psb_bsrch(tidx,nv,idxmap%srt_l2g(:,1)) +!!$ if (idxout(i) > 0) idxout(i) = idxmap%srt_l2g(idxout(i),2)+idxmap%local_rows +!!$ else +!!$ idxout(i) = -1 +!!$ end if +!!$ end if +!!$ end do +!!$ else if (idxmap%is_valid()) then +!!$ do i=1,im +!!$ if (mask(i)) then +!!$ if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then +!!$ idxout(i) = idxin(i) - idxmap%min_glob_row + 1 +!!$ else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)& +!!$ &.and.(.not.owned_)) then +!!$ ip = idxin(i) +!!$ call psb_hash_searchkey(ip,lip,idxmap%hash,info) +!!$ if (lip > 0) idxout(i) = lip + idxmap%local_rows +!!$ else +!!$ idxout(i) = -1 +!!$ end if +!!$ end if +!!$ end do +!!$ else +!!$! !$ write(0,*) 'Block status: invalid ',idxmap%get_state() +!!$ idxout(1:im) = -1 +!!$ info = -1 +!!$ end if +!!$ +!!$ else if (.not.present(mask)) then +!!$ +!!$ if (idxmap%is_asb()) then +!!$ do i=1, im +!!$ if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then +!!$ idxout(i) = idxin(i) - idxmap%min_glob_row + 1 +!!$ else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)& +!!$ &.and.(.not.owned_)) then +!!$ nv = size(idxmap%srt_l2g,1) +!!$ tidx = idxin(i) +!!$ idxout(i) = psb_bsrch(tidx,nv,idxmap%srt_l2g(:,1)) +!!$ if (idxout(i) > 0) idxout(i) = idxmap%srt_l2g(idxout(i),2)+idxmap%local_rows +!!$ else +!!$ idxout(i) = -1 +!!$ end if +!!$ end do +!!$ +!!$ else if (idxmap%is_valid()) then +!!$ do i=1,im +!!$ if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then +!!$ idxout(i) = idxin(i) - idxmap%min_glob_row + 1 +!!$ else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)& +!!$ &.and.(.not.owned_)) then +!!$ ip = idxin(i) +!!$ call psb_hash_searchkey(ip,lip,idxmap%hash,info) +!!$ if (lip > 0) idxout(i) = lip + idxmap%local_rows +!!$ else +!!$ idxout(i) = -1 +!!$ end if +!!$ end do +!!$ else +!!$! !$ write(0,*) 'Block status: invalid ',idxmap%get_state() +!!$ idxout(1:im) = -1 +!!$ info = -1 +!!$ end if +!!$ +!!$ end if +!!$ +!!$ if (is > im) info = -3 +!!$ +!!$ end subroutine block_g2lv2 + - subroutine block_g2ls1(idx,idxmap,info,mask,owned) + subroutine block_lg2ls1(idx,idxmap,info,mask,owned) implicit none class(psb_gen_block_map), intent(in) :: idxmap - integer(psb_ipk_), intent(inout) :: idx + integer(psb_lpk_), intent(inout) :: idx integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask logical, intent(in), optional :: owned - integer(psb_ipk_) :: idxv(1) + integer(psb_lpk_) :: idxv(1) info = 0 if (present(mask)) then @@ -487,29 +749,37 @@ contains call idxmap%g2lip(idxv,info,owned=owned) idx = idxv(1) - end subroutine block_g2ls1 + end subroutine block_lg2ls1 - subroutine block_g2ls2(idxin,idxout,idxmap,info,mask,owned) + subroutine block_lg2ls2(idxin,idxout,idxmap,info,mask,owned) implicit none class(psb_gen_block_map), intent(in) :: idxmap - integer(psb_ipk_), intent(in) :: idxin + integer(psb_lpk_), intent(in) :: idxin integer(psb_ipk_), intent(out) :: idxout integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask logical, intent(in), optional :: owned - idxout = idxin - call idxmap%g2lip(idxout,info,mask,owned) + integer(psb_lpk_) :: idxv(1) + info = 0 + + if (present(mask)) then + if (.not.mask) return + end if - end subroutine block_g2ls2 + idxv(1) = idxin + call idxmap%g2lip(idxv,info,owned=owned) + idxout = idxv(1) + + end subroutine block_lg2ls2 - subroutine block_g2lv1(idx,idxmap,info,mask,owned) + subroutine block_lg2lv1(idx,idxmap,info,mask,owned) use psb_penv_mod use psb_sort_mod implicit none class(psb_gen_block_map), intent(in) :: idxmap - integer(psb_ipk_), intent(inout) :: idx(:) + integer(psb_lpk_), intent(inout) :: idx(:) integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask(:) logical, intent(in), optional :: owned @@ -597,845 +867,582 @@ contains if ((idxmap%min_glob_row <= idx(i)).and.(idx(i) <= idxmap%max_glob_row)) then idx(i) = idx(i) - idxmap%min_glob_row + 1 else if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)& - &.and.(.not.owned_)) then - ip = idx(i) - call psb_hash_searchkey(ip,lip,idxmap%hash,info) - if (lip > 0) idx(i) = lip + idxmap%local_rows - else - idx(i) = -1 - end if - end do - else -!!$ write(0,*) 'Block status: invalid ',idxmap%get_state() - idx(1:is) = -1 - info = -1 - end if - - end if - - end subroutine block_g2lv1 - - subroutine block_g2lv2(idxin,idxout,idxmap,info,mask,owned) - use psb_penv_mod - use psb_sort_mod - implicit none - class(psb_gen_block_map), intent(in) :: idxmap - integer(psb_ipk_), intent(in) :: idxin(:) - integer(psb_ipk_), intent(out) :: idxout(:) - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask(:) - logical, intent(in), optional :: owned - - integer(psb_ipk_) :: i, nv, is, ip, lip, im - integer(psb_lpk_) :: tidx - integer(psb_mpk_) :: ictxt, iam, np - logical :: owned_ - - info = 0 - ictxt = idxmap%get_ctxt() - call psb_info(ictxt,iam,np) - is = size(idxin) - im = min(is,size(idxout)) - - if (present(mask)) then - if (size(mask) < im) then -!!$ write(0,*) 'Block g2l: size of mask', size(mask),size(idx) - info = -1 - return - end if - end if - if (present(owned)) then - owned_ = owned - else - owned_ = .false. - end if - - if (present(mask)) then - - if (idxmap%is_asb()) then - do i=1, im - if (mask(i)) then - if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then - idxout(i) = idxin(i) - idxmap%min_glob_row + 1 - else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)& - &.and.(.not.owned_)) then - nv = size(idxmap%srt_l2g,1) - tidx = idxin(i) - idxout(i) = psb_bsrch(tidx,nv,idxmap%srt_l2g(:,1)) - if (idxout(i) > 0) idxout(i) = idxmap%srt_l2g(idxout(i),2)+idxmap%local_rows - else - idxout(i) = -1 - end if - end if - end do - else if (idxmap%is_valid()) then - do i=1,im - if (mask(i)) then - if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then - idxout(i) = idxin(i) - idxmap%min_glob_row + 1 - else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)& - &.and.(.not.owned_)) then - ip = idxin(i) - call psb_hash_searchkey(ip,lip,idxmap%hash,info) - if (lip > 0) idxout(i) = lip + idxmap%local_rows - else - idxout(i) = -1 - end if - end if - end do - else -!!$ write(0,*) 'Block status: invalid ',idxmap%get_state() - idxout(1:im) = -1 - info = -1 - end if - - else if (.not.present(mask)) then - - if (idxmap%is_asb()) then - do i=1, im - if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then - idxout(i) = idxin(i) - idxmap%min_glob_row + 1 - else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)& - &.and.(.not.owned_)) then - nv = size(idxmap%srt_l2g,1) - tidx = idxin(i) - idxout(i) = psb_bsrch(tidx,nv,idxmap%srt_l2g(:,1)) - if (idxout(i) > 0) idxout(i) = idxmap%srt_l2g(idxout(i),2)+idxmap%local_rows - else - idxout(i) = -1 - end if - end do - - else if (idxmap%is_valid()) then - do i=1,im - if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then - idxout(i) = idxin(i) - idxmap%min_glob_row + 1 - else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)& - &.and.(.not.owned_)) then - ip = idxin(i) - call psb_hash_searchkey(ip,lip,idxmap%hash,info) - if (lip > 0) idxout(i) = lip + idxmap%local_rows - else - idxout(i) = -1 - end if - end do - else -!!$ write(0,*) 'Block status: invalid ',idxmap%get_state() - idxout(1:im) = -1 - info = -1 - end if - - end if - - if (is > im) info = -3 - - end subroutine block_g2lv2 - - - subroutine block_lg2ls1(idx,idxmap,info,mask,owned) - implicit none - class(psb_gen_block_map), intent(in) :: idxmap - integer(psb_lpk_), intent(inout) :: idx - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask - logical, intent(in), optional :: owned - integer(psb_lpk_) :: idxv(1) - info = 0 - - if (present(mask)) then - if (.not.mask) return - end if - - idxv(1) = idx - call idxmap%g2lip(idxv,info,owned=owned) - idx = idxv(1) - - end subroutine block_lg2ls1 - - subroutine block_lg2ls2(idxin,idxout,idxmap,info,mask,owned) - implicit none - class(psb_gen_block_map), intent(in) :: idxmap - integer(psb_lpk_), intent(in) :: idxin - integer(psb_ipk_), intent(out) :: idxout - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask - logical, intent(in), optional :: owned - - idxout = idxin - call idxmap%g2lip(idxout,info,mask,owned) - - end subroutine block_lg2ls2 - - - subroutine block_lg2lv1(idx,idxmap,info,mask,owned) - use psb_penv_mod - use psb_sort_mod - implicit none - class(psb_gen_block_map), intent(in) :: idxmap - integer(psb_lpk_), intent(inout) :: idx(:) - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask(:) - logical, intent(in), optional :: owned - integer(psb_ipk_) :: i, nv, is, ip, lip - integer(psb_lpk_) :: tidx - integer(psb_mpk_) :: ictxt, iam, np - logical :: owned_ - - info = 0 - ictxt = idxmap%get_ctxt() - call psb_info(ictxt,iam,np) - - if (present(mask)) then - if (size(mask) < size(idx)) then -!!$ write(0,*) 'Block g2l: size of mask', size(mask),size(idx) - info = -1 - return - end if - end if - if (present(owned)) then - owned_ = owned - else - owned_ = .false. - end if - - is = size(idx) - if (present(mask)) then - - if (idxmap%is_asb()) then - do i=1, is - if (mask(i)) then - if ((idxmap%min_glob_row <= idx(i)).and.(idx(i) <= idxmap%max_glob_row)) then - idx(i) = idx(i) - idxmap%min_glob_row + 1 - else if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)& - &.and.(.not.owned_)) then - nv = size(idxmap%srt_l2g,1) - tidx = idx(i) - idx(i) = psb_bsrch(tidx,nv,idxmap%srt_l2g(:,1)) - if (idx(i) > 0) idx(i) = idxmap%srt_l2g(idx(i),2)+idxmap%local_rows - else - idx(i) = -1 - end if - end if - end do - else if (idxmap%is_valid()) then - do i=1,is - if (mask(i)) then - if ((idxmap%min_glob_row <= idx(i)).and.(idx(i) <= idxmap%max_glob_row)) then - idx(i) = idx(i) - idxmap%min_glob_row + 1 - else if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)& - &.and.(.not.owned_)) then - ip = idx(i) - call psb_hash_searchkey(ip,lip,idxmap%hash,info) - if (lip > 0) idx(i) = lip + idxmap%local_rows - else - idx(i) = -1 - end if - end if - end do - else -!!$ write(0,*) 'Block status: invalid ',idxmap%get_state() - idx(1:is) = -1 - info = -1 - end if - - else if (.not.present(mask)) then - - if (idxmap%is_asb()) then - do i=1, is - if ((idxmap%min_glob_row <= idx(i)).and.(idx(i) <= idxmap%max_glob_row)) then - idx(i) = idx(i) - idxmap%min_glob_row + 1 - else if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)& - &.and.(.not.owned_)) then - nv = size(idxmap%srt_l2g,1) - tidx = idx(i) - idx(i) = psb_bsrch(tidx,nv,idxmap%srt_l2g(:,1)) - if (idx(i) > 0) idx(i) = idxmap%srt_l2g(idx(i),2)+idxmap%local_rows - else - idx(i) = -1 - end if - end do - - else if (idxmap%is_valid()) then - do i=1,is - if ((idxmap%min_glob_row <= idx(i)).and.(idx(i) <= idxmap%max_glob_row)) then - idx(i) = idx(i) - idxmap%min_glob_row + 1 - else if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)& - &.and.(.not.owned_)) then - ip = idx(i) - call psb_hash_searchkey(ip,lip,idxmap%hash,info) - if (lip > 0) idx(i) = lip + idxmap%local_rows - else - idx(i) = -1 - end if - end do - else -!!$ write(0,*) 'Block status: invalid ',idxmap%get_state() - idx(1:is) = -1 - info = -1 - end if - - end if - - end subroutine block_lg2lv1 - - subroutine block_lg2lv2(idxin,idxout,idxmap,info,mask,owned) - use psb_penv_mod - use psb_sort_mod - implicit none - class(psb_gen_block_map), intent(in) :: idxmap - integer(psb_lpk_), intent(in) :: idxin(:) - integer(psb_ipk_), intent(out) :: idxout(:) - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask(:) - logical, intent(in), optional :: owned - - integer(psb_ipk_) :: i, nv, is, ip, lip, im - integer(psb_lpk_) :: tidx - integer(psb_mpk_) :: ictxt, iam, np - logical :: owned_ - - info = 0 - ictxt = idxmap%get_ctxt() - call psb_info(ictxt,iam,np) - is = size(idxin) - im = min(is,size(idxout)) - - if (present(mask)) then - if (size(mask) < im) then -!!$ write(0,*) 'Block g2l: size of mask', size(mask),size(idx) - info = -1 - return - end if - end if - if (present(owned)) then - owned_ = owned - else - owned_ = .false. - end if - - if (present(mask)) then - - if (idxmap%is_asb()) then - do i=1, im - if (mask(i)) then - if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then - idxout(i) = idxin(i) - idxmap%min_glob_row + 1 - else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)& - &.and.(.not.owned_)) then - nv = size(idxmap%srt_l2g,1) - tidx = idxin(i) - idxout(i) = psb_bsrch(tidx,nv,idxmap%srt_l2g(:,1)) - if (idxout(i) > 0) idxout(i) = idxmap%srt_l2g(idxout(i),2)+idxmap%local_rows - else - idxout(i) = -1 - end if - end if - end do - else if (idxmap%is_valid()) then - do i=1,im - if (mask(i)) then - if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then - idxout(i) = idxin(i) - idxmap%min_glob_row + 1 - else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)& - &.and.(.not.owned_)) then - ip = idxin(i) - call psb_hash_searchkey(ip,lip,idxmap%hash,info) - if (lip > 0) idxout(i) = lip + idxmap%local_rows - else - idxout(i) = -1 - end if - end if - end do - else -!!$ write(0,*) 'Block status: invalid ',idxmap%get_state() - idxout(1:im) = -1 - info = -1 - end if - - else if (.not.present(mask)) then - - if (idxmap%is_asb()) then - do i=1, im - if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then - idxout(i) = idxin(i) - idxmap%min_glob_row + 1 - else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)& - &.and.(.not.owned_)) then - nv = size(idxmap%srt_l2g,1) - tidx = idxin(i) - idxout(i) = psb_bsrch(tidx,nv,idxmap%srt_l2g(:,1)) - if (idxout(i) > 0) idxout(i) = idxmap%srt_l2g(idxout(i),2)+idxmap%local_rows - else - idxout(i) = -1 - end if - end do - - else if (idxmap%is_valid()) then - do i=1,im - if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then - idxout(i) = idxin(i) - idxmap%min_glob_row + 1 - else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)& - &.and.(.not.owned_)) then - ip = idxin(i) - call psb_hash_searchkey(ip,lip,idxmap%hash,info) - if (lip > 0) idxout(i) = lip + idxmap%local_rows - else - idxout(i) = -1 - end if - end do - else -!!$ write(0,*) 'Block status: invalid ',idxmap%get_state() - idxout(1:im) = -1 - info = -1 - end if - - end if - - if (is > im) info = -3 - - end subroutine block_lg2lv2 - - subroutine block_g2ls1_ins(idx,idxmap,info,mask, lidx) - use psb_realloc_mod - use psb_sort_mod - implicit none - class(psb_gen_block_map), intent(inout) :: idxmap - integer(psb_ipk_), intent(inout) :: idx - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask - integer(psb_ipk_), intent(in), optional :: lidx - - integer(psb_ipk_) :: idxv(1), lidxv(1) - - info = 0 - if (present(mask)) then - if (.not.mask) return - end if - idxv(1) = idx - if (present(lidx)) then - lidxv(1) = lidx - call idxmap%g2lip_ins(idxv,info,lidx=lidxv) - else - call idxmap%g2lip_ins(idxv,info) - end if - idx = idxv(1) - - end subroutine block_g2ls1_ins - - subroutine block_g2ls2_ins(idxin,idxout,idxmap,info,mask,lidx) - implicit none - class(psb_gen_block_map), intent(inout) :: idxmap - integer(psb_ipk_), intent(in) :: idxin - integer(psb_ipk_), intent(out) :: idxout - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask - integer(psb_ipk_), intent(in), optional :: lidx - - idxout = idxin - call idxmap%g2lip_ins(idxout,info,mask=mask,lidx=lidx) - - end subroutine block_g2ls2_ins - - - subroutine block_g2lv1_ins(idx,idxmap,info,mask,lidx) - use psb_realloc_mod - use psb_sort_mod - implicit none - class(psb_gen_block_map), intent(inout) :: idxmap - integer(psb_ipk_), intent(inout) :: idx(:) - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask(:) - integer(psb_ipk_), intent(in), optional :: lidx(:) - - integer(psb_ipk_) :: i, nv, is, ix - integer(psb_ipk_) :: ip, lip, nxt - - - info = 0 - is = size(idx) - - if (present(mask)) then - if (size(mask) < size(idx)) then - info = -1 - return - end if - end if - if (present(lidx)) then - if (size(lidx) < size(idx)) then - info = -1 - return - end if - end if - - - if (idxmap%is_asb()) then - ! State is wrong for this one ! - idx = -1 - info = -1 - - else if (idxmap%is_valid()) then - - if (present(lidx)) then - if (present(mask)) then - - do i=1, is - if (mask(i)) then - if ((idxmap%min_glob_row <= idx(i)).and.(idx(i) <= idxmap%max_glob_row)) then - idx(i) = idx(i) - idxmap%min_glob_row + 1 - else if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then - - if (lidx(i) <= idxmap%local_rows) then - info = -5 - return - end if - nxt = lidx(i)-idxmap%local_rows - ip = idx(i) - call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) - if (info >= 0) then - if (lip == nxt) then - ! We have added one item - call psb_ensure_size(nxt,idxmap%loc_to_glob,info,addsz=laddsz) - if (info /= 0) then - info = -4 - return - end if - idxmap%local_cols = max(lidx(i),idxmap%local_cols) - idxmap%loc_to_glob(nxt) = idx(i) - end if - info = psb_success_ - else - info = -5 - return - end if - idx(i) = lip + idxmap%local_rows - else - idx(i) = -1 - info = -1 - end if - end if - end do - - else if (.not.present(mask)) then - - do i=1, is - - if ((idxmap%min_glob_row <= idx(i)).and.(idx(i) <= idxmap%max_glob_row)) then - idx(i) = idx(i) - idxmap%min_glob_row + 1 - else if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then - if (lidx(i) <= idxmap%local_rows) then - info = -5 - return - end if - nxt = lidx(i)-idxmap%local_rows - ip = idx(i) - call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) - - if (info >= 0) then - if (lip == nxt) then - ! We have added one item - call psb_ensure_size(nxt,idxmap%loc_to_glob,info,addsz=laddsz) - if (info /= 0) then - info = -4 - return - end if - idxmap%local_cols = max(lidx(i),idxmap%local_cols) - idxmap%loc_to_glob(nxt) = idx(i) - end if - info = psb_success_ - else - info = -5 - return - end if - idx(i) = lip + idxmap%local_rows - else - idx(i) = -1 - info = -1 - end if - end do - end if - - else if (.not.present(lidx)) then - - if (present(mask)) then - do i=1, is - if (mask(i)) then - if ((idxmap%min_glob_row <= idx(i)).and.(idx(i) <= idxmap%max_glob_row)) then - idx(i) = idx(i) - idxmap%min_glob_row + 1 - else if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then - nv = idxmap%local_cols-idxmap%local_rows - nxt = nv + 1 - ip = idx(i) - call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) - if (info >= 0) then - if (lip == nxt) then - ! We have added one item - call psb_ensure_size(nxt,idxmap%loc_to_glob,info,addsz=laddsz) - if (info /= 0) then - info = -4 - return - end if - idxmap%local_cols = nxt + idxmap%local_rows - idxmap%loc_to_glob(nxt) = idx(i) - end if - info = psb_success_ - else - info = -5 - return - end if - idx(i) = lip + idxmap%local_rows - else - idx(i) = -1 - info = -1 - end if - end if - end do - - else if (.not.present(mask)) then - - do i=1, is - - if ((idxmap%min_glob_row <= idx(i)).and.(idx(i) <= idxmap%max_glob_row)) then - idx(i) = idx(i) - idxmap%min_glob_row + 1 - else if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then - nv = idxmap%local_cols-idxmap%local_rows - nxt = nv + 1 - ip = idx(i) - call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) - - if (info >= 0) then - if (lip == nxt) then - ! We have added one item - call psb_ensure_size(nxt,idxmap%loc_to_glob,info,addsz=laddsz) - if (info /= 0) then - info = -4 - return - end if - idxmap%local_cols = nxt + idxmap%local_rows - idxmap%loc_to_glob(nxt) = idx(i) - end if - info = psb_success_ - else - info = -5 - return - end if - idx(i) = lip + idxmap%local_rows - else - idx(i) = -1 - info = -1 - end if - end do - end if + &.and.(.not.owned_)) then + ip = idx(i) + call psb_hash_searchkey(ip,lip,idxmap%hash,info) + if (lip > 0) idx(i) = lip + idxmap%local_rows + else + idx(i) = -1 + end if + end do + else +!!$ write(0,*) 'Block status: invalid ',idxmap%get_state() + idx(1:is) = -1 + info = -1 end if - else - idx = -1 - info = -1 end if - end subroutine block_g2lv1_ins + end subroutine block_lg2lv1 - subroutine block_g2lv2_ins(idxin,idxout,idxmap,info,mask,lidx) - use psb_realloc_mod + subroutine block_lg2lv2(idxin,idxout,idxmap,info,mask,owned) + use psb_penv_mod use psb_sort_mod implicit none - class(psb_gen_block_map), intent(inout) :: idxmap - integer(psb_ipk_), intent(in) :: idxin(:) + class(psb_gen_block_map), intent(in) :: idxmap + integer(psb_lpk_), intent(in) :: idxin(:) integer(psb_ipk_), intent(out) :: idxout(:) integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask(:) - integer(psb_ipk_), intent(in), optional :: lidx(:) - - integer(psb_ipk_) :: i, nv, is, ix, im - integer(psb_ipk_) :: ip, lip, nxt + logical, intent(in), optional :: owned + integer(psb_ipk_) :: i, nv, is, ip, lip, im + integer(psb_lpk_) :: tidx + integer(psb_mpk_) :: ictxt, iam, np + logical :: owned_ info = 0 - + ictxt = idxmap%get_ctxt() + call psb_info(ictxt,iam,np) is = size(idxin) im = min(is,size(idxout)) if (present(mask)) then if (size(mask) < im) then +!!$ write(0,*) 'Block g2l: size of mask', size(mask),size(idx) info = -1 return end if end if - if (present(lidx)) then - if (size(lidx) < im) then - info = -1 - return - end if + if (present(owned)) then + owned_ = owned + else + owned_ = .false. end if - if (idxmap%is_asb()) then - ! State is wrong for this one ! - idxout = -1 - info = -1 - - else if (idxmap%is_valid()) then - - if (present(lidx)) then - if (present(mask)) then - - do i=1, im - if (mask(i)) then - if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then - idxout(i) = idxin(i) - idxmap%min_glob_row + 1 - else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)) then - - if (lidx(i) <= idxmap%local_rows) then - info = -5 - return - end if - nxt = lidx(i)-idxmap%local_rows - ip = idxin(i) - call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) - if (info >= 0) then - if (lip == nxt) then - ! We have added one item - call psb_ensure_size(nxt,idxmap%loc_to_glob,info,addsz=laddsz) - if (info /= 0) then - info = -4 - return - end if - idxmap%local_cols = max(lidx(i),idxmap%local_cols) - idxmap%loc_to_glob(nxt) = idxin(i) - end if - info = psb_success_ - else - info = -5 - return - end if - idxout(i) = lip + idxmap%local_rows - else - idxout(i) = -1 - info = -1 - end if - end if - end do - - else if (.not.present(mask)) then - - do i=1, im + if (present(mask)) then + if (idxmap%is_asb()) then + do i=1, im + if (mask(i)) then if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then idxout(i) = idxin(i) - idxmap%min_glob_row + 1 - else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)) then - if (lidx(i) <= idxmap%local_rows) then - info = -5 - return - end if - nxt = lidx(i)-idxmap%local_rows - ip = idxin(i) - call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) - - if (info >= 0) then - if (lip == nxt) then - ! We have added one item - call psb_ensure_size(nxt,idxmap%loc_to_glob,info,addsz=laddsz) - if (info /= 0) then - info = -4 - return - end if - idxmap%local_cols = max(lidx(i),idxmap%local_cols) - idxmap%loc_to_glob(nxt) = idxin(i) - end if - info = psb_success_ - else - info = -5 - return - end if - idxout(i) = lip + idxmap%local_rows + else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)& + &.and.(.not.owned_)) then + nv = size(idxmap%srt_l2g,1) + tidx = idxin(i) + idxout(i) = psb_bsrch(tidx,nv,idxmap%srt_l2g(:,1)) + if (idxout(i) > 0) idxout(i) = idxmap%srt_l2g(idxout(i),2)+idxmap%local_rows else idxout(i) = -1 - info = -1 - end if - end do - end if - - else if (.not.present(lidx)) then - - if (present(mask)) then - do i=1, im - if (mask(i)) then - if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then - idxout(i) = idxin(i) - idxmap%min_glob_row + 1 - else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)) then - nv = idxmap%local_cols-idxmap%local_rows - nxt = nv + 1 - ip = idxin(i) - call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) - if (info >= 0) then - if (lip == nxt) then - ! We have added one item - call psb_ensure_size(nxt,idxmap%loc_to_glob,info,addsz=laddsz) - if (info /= 0) then - info = -4 - return - end if - idxmap%local_cols = nxt + idxmap%local_rows - idxmap%loc_to_glob(nxt) = idxin(i) - end if - info = psb_success_ - else - info = -5 - return - end if - idxout(i) = lip + idxmap%local_rows - else - idxout(i) = -1 - info = -1 - end if end if - end do - - else if (.not.present(mask)) then - - do i=1, im - + end if + end do + else if (idxmap%is_valid()) then + do i=1,im + if (mask(i)) then if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then idxout(i) = idxin(i) - idxmap%min_glob_row + 1 - else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)) then - nv = idxmap%local_cols-idxmap%local_rows - nxt = nv + 1 - ip = idxin(i) - call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) - - if (info >= 0) then - if (lip == nxt) then - ! We have added one item - call psb_ensure_size(nxt,idxmap%loc_to_glob,info,addsz=laddsz) - if (info /= 0) then - info = -4 - return - end if - idxmap%local_cols = nxt + idxmap%local_rows - idxmap%loc_to_glob(nxt) = idxin(i) - end if - info = psb_success_ - else - info = -5 - return - end if - idxout(i) = lip + idxmap%local_rows + else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)& + &.and.(.not.owned_)) then + ip = idxin(i) + call psb_hash_searchkey(ip,lip,idxmap%hash,info) + if (lip > 0) idxout(i) = lip + idxmap%local_rows else idxout(i) = -1 - info = -1 end if - end do - end if + end if + end do + else +!!$ write(0,*) 'Block status: invalid ',idxmap%get_state() + idxout(1:im) = -1 + info = -1 end if - else - idxout = -1 - info = -1 - end if + else if (.not.present(mask)) then + + if (idxmap%is_asb()) then + do i=1, im + if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then + idxout(i) = idxin(i) - idxmap%min_glob_row + 1 + else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)& + &.and.(.not.owned_)) then + nv = size(idxmap%srt_l2g,1) + tidx = idxin(i) + idxout(i) = psb_bsrch(tidx,nv,idxmap%srt_l2g(:,1)) + if (idxout(i) > 0) idxout(i) = idxmap%srt_l2g(idxout(i),2)+idxmap%local_rows + else + idxout(i) = -1 + end if + end do + + else if (idxmap%is_valid()) then + do i=1,im + if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then + idxout(i) = idxin(i) - idxmap%min_glob_row + 1 + else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)& + &.and.(.not.owned_)) then + ip = idxin(i) + call psb_hash_searchkey(ip,lip,idxmap%hash,info) + if (lip > 0) idxout(i) = lip + idxmap%local_rows + else + idxout(i) = -1 + end if + end do + else +!!$ write(0,*) 'Block status: invalid ',idxmap%get_state() + idxout(1:im) = -1 + info = -1 + end if - if (is > im) then -!!$ write(0,*) 'g2lv2_ins err -3' - info = -3 end if - end subroutine block_g2lv2_ins + if (is > im) info = -3 + + end subroutine block_lg2lv2 + +!!$ subroutine block_g2ls1_ins(idx,idxmap,info,mask, lidx) +!!$ use psb_realloc_mod +!!$ use psb_sort_mod +!!$ implicit none +!!$ class(psb_gen_block_map), intent(inout) :: idxmap +!!$ integer(psb_ipk_), intent(inout) :: idx +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask +!!$ integer(psb_ipk_), intent(in), optional :: lidx +!!$ +!!$ integer(psb_ipk_) :: idxv(1), lidxv(1) +!!$ +!!$ info = 0 +!!$ if (present(mask)) then +!!$ if (.not.mask) return +!!$ end if +!!$ idxv(1) = idx +!!$ if (present(lidx)) then +!!$ lidxv(1) = lidx +!!$ call idxmap%g2lip_ins(idxv,info,lidx=lidxv) +!!$ else +!!$ call idxmap%g2lip_ins(idxv,info) +!!$ end if +!!$ idx = idxv(1) +!!$ +!!$ end subroutine block_g2ls1_ins +!!$ +!!$ subroutine block_g2ls2_ins(idxin,idxout,idxmap,info,mask,lidx) +!!$ implicit none +!!$ class(psb_gen_block_map), intent(inout) :: idxmap +!!$ integer(psb_ipk_), intent(in) :: idxin +!!$ integer(psb_ipk_), intent(out) :: idxout +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask +!!$ integer(psb_ipk_), intent(in), optional :: lidx +!!$ +!!$ idxout = idxin +!!$ call idxmap%g2lip_ins(idxout,info,mask=mask,lidx=lidx) +!!$ +!!$ end subroutine block_g2ls2_ins +!!$ +!!$ +!!$ subroutine block_g2lv1_ins(idx,idxmap,info,mask,lidx) +!!$ use psb_realloc_mod +!!$ use psb_sort_mod +!!$ implicit none +!!$ class(psb_gen_block_map), intent(inout) :: idxmap +!!$ integer(psb_ipk_), intent(inout) :: idx(:) +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask(:) +!!$ integer(psb_ipk_), intent(in), optional :: lidx(:) +!!$ +!!$ integer(psb_ipk_) :: i, nv, is, ix +!!$ integer(psb_ipk_) :: ip, lip, nxt +!!$ +!!$ +!!$ info = 0 +!!$ is = size(idx) +!!$ +!!$ if (present(mask)) then +!!$ if (size(mask) < size(idx)) then +!!$ info = -1 +!!$ return +!!$ end if +!!$ end if +!!$ if (present(lidx)) then +!!$ if (size(lidx) < size(idx)) then +!!$ info = -1 +!!$ return +!!$ end if +!!$ end if +!!$ +!!$ +!!$ if (idxmap%is_asb()) then +!!$ ! State is wrong for this one ! +!!$ idx = -1 +!!$ info = -1 +!!$ +!!$ else if (idxmap%is_valid()) then +!!$ +!!$ if (present(lidx)) then +!!$ if (present(mask)) then +!!$ +!!$ do i=1, is +!!$ if (mask(i)) then +!!$ if ((idxmap%min_glob_row <= idx(i)).and.(idx(i) <= idxmap%max_glob_row)) then +!!$ idx(i) = idx(i) - idxmap%min_glob_row + 1 +!!$ else if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then +!!$ +!!$ if (lidx(i) <= idxmap%local_rows) then +!!$ info = -5 +!!$ return +!!$ end if +!!$ nxt = lidx(i)-idxmap%local_rows +!!$ ip = idx(i) +!!$ call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) +!!$ if (info >= 0) then +!!$ if (lip == nxt) then +!!$ ! We have added one item +!!$ call psb_ensure_size(nxt,idxmap%loc_to_glob,info,addsz=laddsz) +!!$ if (info /= 0) then +!!$ info = -4 +!!$ return +!!$ end if +!!$ idxmap%local_cols = max(lidx(i),idxmap%local_cols) +!!$ idxmap%loc_to_glob(nxt) = idx(i) +!!$ end if +!!$ info = psb_success_ +!!$ else +!!$ info = -5 +!!$ return +!!$ end if +!!$ idx(i) = lip + idxmap%local_rows +!!$ else +!!$ idx(i) = -1 +!!$ info = -1 +!!$ end if +!!$ end if +!!$ end do +!!$ +!!$ else if (.not.present(mask)) then +!!$ +!!$ do i=1, is +!!$ +!!$ if ((idxmap%min_glob_row <= idx(i)).and.(idx(i) <= idxmap%max_glob_row)) then +!!$ idx(i) = idx(i) - idxmap%min_glob_row + 1 +!!$ else if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then +!!$ if (lidx(i) <= idxmap%local_rows) then +!!$ info = -5 +!!$ return +!!$ end if +!!$ nxt = lidx(i)-idxmap%local_rows +!!$ ip = idx(i) +!!$ call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) +!!$ +!!$ if (info >= 0) then +!!$ if (lip == nxt) then +!!$ ! We have added one item +!!$ call psb_ensure_size(nxt,idxmap%loc_to_glob,info,addsz=laddsz) +!!$ if (info /= 0) then +!!$ info = -4 +!!$ return +!!$ end if +!!$ idxmap%local_cols = max(lidx(i),idxmap%local_cols) +!!$ idxmap%loc_to_glob(nxt) = idx(i) +!!$ end if +!!$ info = psb_success_ +!!$ else +!!$ info = -5 +!!$ return +!!$ end if +!!$ idx(i) = lip + idxmap%local_rows +!!$ else +!!$ idx(i) = -1 +!!$ info = -1 +!!$ end if +!!$ end do +!!$ end if +!!$ +!!$ else if (.not.present(lidx)) then +!!$ +!!$ if (present(mask)) then +!!$ do i=1, is +!!$ if (mask(i)) then +!!$ if ((idxmap%min_glob_row <= idx(i)).and.(idx(i) <= idxmap%max_glob_row)) then +!!$ idx(i) = idx(i) - idxmap%min_glob_row + 1 +!!$ else if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then +!!$ nv = idxmap%local_cols-idxmap%local_rows +!!$ nxt = nv + 1 +!!$ ip = idx(i) +!!$ call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) +!!$ if (info >= 0) then +!!$ if (lip == nxt) then +!!$ ! We have added one item +!!$ call psb_ensure_size(nxt,idxmap%loc_to_glob,info,addsz=laddsz) +!!$ if (info /= 0) then +!!$ info = -4 +!!$ return +!!$ end if +!!$ idxmap%local_cols = nxt + idxmap%local_rows +!!$ idxmap%loc_to_glob(nxt) = idx(i) +!!$ end if +!!$ info = psb_success_ +!!$ else +!!$ info = -5 +!!$ return +!!$ end if +!!$ idx(i) = lip + idxmap%local_rows +!!$ else +!!$ idx(i) = -1 +!!$ info = -1 +!!$ end if +!!$ end if +!!$ end do +!!$ +!!$ else if (.not.present(mask)) then +!!$ +!!$ do i=1, is +!!$ +!!$ if ((idxmap%min_glob_row <= idx(i)).and.(idx(i) <= idxmap%max_glob_row)) then +!!$ idx(i) = idx(i) - idxmap%min_glob_row + 1 +!!$ else if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then +!!$ nv = idxmap%local_cols-idxmap%local_rows +!!$ nxt = nv + 1 +!!$ ip = idx(i) +!!$ call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) +!!$ +!!$ if (info >= 0) then +!!$ if (lip == nxt) then +!!$ ! We have added one item +!!$ call psb_ensure_size(nxt,idxmap%loc_to_glob,info,addsz=laddsz) +!!$ if (info /= 0) then +!!$ info = -4 +!!$ return +!!$ end if +!!$ idxmap%local_cols = nxt + idxmap%local_rows +!!$ idxmap%loc_to_glob(nxt) = idx(i) +!!$ end if +!!$ info = psb_success_ +!!$ else +!!$ info = -5 +!!$ return +!!$ end if +!!$ idx(i) = lip + idxmap%local_rows +!!$ else +!!$ idx(i) = -1 +!!$ info = -1 +!!$ end if +!!$ end do +!!$ end if +!!$ end if +!!$ +!!$ else +!!$ idx = -1 +!!$ info = -1 +!!$ end if +!!$ +!!$ end subroutine block_g2lv1_ins +!!$ +!!$ subroutine block_g2lv2_ins(idxin,idxout,idxmap,info,mask,lidx) +!!$ use psb_realloc_mod +!!$ use psb_sort_mod +!!$ implicit none +!!$ class(psb_gen_block_map), intent(inout) :: idxmap +!!$ integer(psb_ipk_), intent(in) :: idxin(:) +!!$ integer(psb_ipk_), intent(out) :: idxout(:) +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask(:) +!!$ integer(psb_ipk_), intent(in), optional :: lidx(:) +!!$ +!!$ integer(psb_ipk_) :: i, nv, is, ix, im +!!$ integer(psb_ipk_) :: ip, lip, nxt +!!$ +!!$ +!!$ info = 0 +!!$ +!!$ is = size(idxin) +!!$ im = min(is,size(idxout)) +!!$ +!!$ if (present(mask)) then +!!$ if (size(mask) < im) then +!!$ info = -1 +!!$ return +!!$ end if +!!$ end if +!!$ if (present(lidx)) then +!!$ if (size(lidx) < im) then +!!$ info = -1 +!!$ return +!!$ end if +!!$ end if +!!$ +!!$ if (idxmap%is_asb()) then +!!$ ! State is wrong for this one ! +!!$ idxout = -1 +!!$ info = -1 +!!$ +!!$ else if (idxmap%is_valid()) then +!!$ +!!$ if (present(lidx)) then +!!$ if (present(mask)) then +!!$ +!!$ do i=1, im +!!$ if (mask(i)) then +!!$ if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then +!!$ idxout(i) = idxin(i) - idxmap%min_glob_row + 1 +!!$ else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)) then +!!$ +!!$ if (lidx(i) <= idxmap%local_rows) then +!!$ info = -5 +!!$ return +!!$ end if +!!$ nxt = lidx(i)-idxmap%local_rows +!!$ ip = idxin(i) +!!$ call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) +!!$ if (info >= 0) then +!!$ if (lip == nxt) then +!!$ ! We have added one item +!!$ call psb_ensure_size(nxt,idxmap%loc_to_glob,info,addsz=laddsz) +!!$ if (info /= 0) then +!!$ info = -4 +!!$ return +!!$ end if +!!$ idxmap%local_cols = max(lidx(i),idxmap%local_cols) +!!$ idxmap%loc_to_glob(nxt) = idxin(i) +!!$ end if +!!$ info = psb_success_ +!!$ else +!!$ info = -5 +!!$ return +!!$ end if +!!$ idxout(i) = lip + idxmap%local_rows +!!$ else +!!$ idxout(i) = -1 +!!$ info = -1 +!!$ end if +!!$ end if +!!$ end do +!!$ +!!$ else if (.not.present(mask)) then +!!$ +!!$ do i=1, im +!!$ +!!$ if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then +!!$ idxout(i) = idxin(i) - idxmap%min_glob_row + 1 +!!$ else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)) then +!!$ if (lidx(i) <= idxmap%local_rows) then +!!$ info = -5 +!!$ return +!!$ end if +!!$ nxt = lidx(i)-idxmap%local_rows +!!$ ip = idxin(i) +!!$ call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) +!!$ +!!$ if (info >= 0) then +!!$ if (lip == nxt) then +!!$ ! We have added one item +!!$ call psb_ensure_size(nxt,idxmap%loc_to_glob,info,addsz=laddsz) +!!$ if (info /= 0) then +!!$ info = -4 +!!$ return +!!$ end if +!!$ idxmap%local_cols = max(lidx(i),idxmap%local_cols) +!!$ idxmap%loc_to_glob(nxt) = idxin(i) +!!$ end if +!!$ info = psb_success_ +!!$ else +!!$ info = -5 +!!$ return +!!$ end if +!!$ idxout(i) = lip + idxmap%local_rows +!!$ else +!!$ idxout(i) = -1 +!!$ info = -1 +!!$ end if +!!$ end do +!!$ end if +!!$ +!!$ else if (.not.present(lidx)) then +!!$ +!!$ if (present(mask)) then +!!$ do i=1, im +!!$ if (mask(i)) then +!!$ if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then +!!$ idxout(i) = idxin(i) - idxmap%min_glob_row + 1 +!!$ else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)) then +!!$ nv = idxmap%local_cols-idxmap%local_rows +!!$ nxt = nv + 1 +!!$ ip = idxin(i) +!!$ call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) +!!$ if (info >= 0) then +!!$ if (lip == nxt) then +!!$ ! We have added one item +!!$ call psb_ensure_size(nxt,idxmap%loc_to_glob,info,addsz=laddsz) +!!$ if (info /= 0) then +!!$ info = -4 +!!$ return +!!$ end if +!!$ idxmap%local_cols = nxt + idxmap%local_rows +!!$ idxmap%loc_to_glob(nxt) = idxin(i) +!!$ end if +!!$ info = psb_success_ +!!$ else +!!$ info = -5 +!!$ return +!!$ end if +!!$ idxout(i) = lip + idxmap%local_rows +!!$ else +!!$ idxout(i) = -1 +!!$ info = -1 +!!$ end if +!!$ end if +!!$ end do +!!$ +!!$ else if (.not.present(mask)) then +!!$ +!!$ do i=1, im +!!$ +!!$ if ((idxmap%min_glob_row <= idxin(i)).and.(idxin(i) <= idxmap%max_glob_row)) then +!!$ idxout(i) = idxin(i) - idxmap%min_glob_row + 1 +!!$ else if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)) then +!!$ nv = idxmap%local_cols-idxmap%local_rows +!!$ nxt = nv + 1 +!!$ ip = idxin(i) +!!$ call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) +!!$ +!!$ if (info >= 0) then +!!$ if (lip == nxt) then +!!$ ! We have added one item +!!$ call psb_ensure_size(nxt,idxmap%loc_to_glob,info,addsz=laddsz) +!!$ if (info /= 0) then +!!$ info = -4 +!!$ return +!!$ end if +!!$ idxmap%local_cols = nxt + idxmap%local_rows +!!$ idxmap%loc_to_glob(nxt) = idxin(i) +!!$ end if +!!$ info = psb_success_ +!!$ else +!!$ info = -5 +!!$ return +!!$ end if +!!$ idxout(i) = lip + idxmap%local_rows +!!$ else +!!$ idxout(i) = -1 +!!$ info = -1 +!!$ end if +!!$ end do +!!$ end if +!!$ end if +!!$ +!!$ else +!!$ idxout = -1 +!!$ info = -1 +!!$ end if +!!$ +!!$ if (is > im) then +!!$! !$ write(0,*) 'g2lv2_ins err -3' +!!$ info = -3 +!!$ end if +!!$ +!!$ end subroutine block_g2lv2_ins subroutine block_lg2ls1_ins(idx,idxmap,info,mask, lidx) use psb_realloc_mod @@ -1890,7 +1897,7 @@ contains subroutine block_fnd_owner(idx,iprc,idxmap,info) use psb_penv_mod implicit none - integer(psb_ipk_), intent(in) :: idx(:) + integer(psb_lpk_), intent(in) :: idx(:) integer(psb_ipk_), allocatable, intent(out) :: iprc(:) class(psb_gen_block_map), intent(in) :: idxmap integer(psb_ipk_), intent(out) :: info @@ -2083,7 +2090,8 @@ contains class(psb_gen_block_map), intent(inout) :: idxmap integer(psb_ipk_), intent(out) :: info integer(psb_ipk_) :: err_act, nr,nc,k, nl, ictxt - integer(psb_ipk_), allocatable :: idx(:),lidx(:) + integer(psb_ipk_), allocatable :: lidx(:) + integer(psb_lpk_), allocatable :: idx(:) character(len=20) :: name='block_reinit' logical, parameter :: debug=.false. @@ -2131,7 +2139,8 @@ contains ! function gen_block_search(key,n,v) result(ipos) implicit none - integer(psb_ipk_) :: ipos, key, n + integer(psb_lpk_) :: key + integer(psb_ipk_) :: ipos, n integer(psb_ipk_) :: v(:) integer(psb_ipk_) :: lb, ub, m diff --git a/base/modules/desc/psb_glist_map_mod.f90 b/base/modules/desc/psb_glist_map_mod.f90 index 35b2862e..154916d3 100644 --- a/base/modules/desc/psb_glist_map_mod.f90 +++ b/base/modules/desc/psb_glist_map_mod.f90 @@ -153,12 +153,12 @@ contains use psb_penv_mod use psb_sort_mod implicit none - integer(psb_ipk_), intent(in) :: idx(:) + integer(psb_lpk_), intent(in) :: idx(:) integer(psb_ipk_), allocatable, intent(out) :: iprc(:) class(psb_glist_map), intent(in) :: idxmap integer(psb_ipk_), intent(out) :: info integer(psb_mpk_) :: ictxt, iam, np - integer(psb_ipk_) :: nv, i, ngp + integer(psb_lpk_) :: nv, i, ngp ictxt = idxmap%get_ctxt() call psb_info(ictxt,iam,np) diff --git a/base/modules/desc/psb_hash_map_mod.f90 b/base/modules/desc/psb_hash_map_mod.f90 index f174c386..7120e23c 100644 --- a/base/modules/desc/psb_hash_map_mod.f90 +++ b/base/modules/desc/psb_hash_map_mod.f90 @@ -61,7 +61,8 @@ module psb_hash_map_mod type, extends(psb_indx_map) :: psb_hash_map integer(psb_ipk_) :: hashvsize, hashvmask - integer(psb_ipk_), allocatable :: hashv(:), glb_lc(:,:), loc_to_glob(:) + integer(psb_ipk_), allocatable :: hashv(:) + integer(psb_lpk_), allocatable :: glb_lc(:,:), loc_to_glob(:) type(psb_hash_type) :: hash contains @@ -78,20 +79,20 @@ module psb_hash_map_mod procedure, nopass :: row_extendable => hash_row_extendable - procedure, pass(idxmap) :: l2gs1 => hash_l2gs1 - procedure, pass(idxmap) :: l2gs2 => hash_l2gs2 - procedure, pass(idxmap) :: l2gv1 => hash_l2gv1 - procedure, pass(idxmap) :: l2gv2 => hash_l2gv2 + procedure, pass(idxmap) :: ll2gs1 => hash_l2gs1 + procedure, pass(idxmap) :: ll2gs2 => hash_l2gs2 + procedure, pass(idxmap) :: ll2gv1 => hash_l2gv1 + procedure, pass(idxmap) :: ll2gv2 => hash_l2gv2 - procedure, pass(idxmap) :: g2ls1 => hash_g2ls1 - procedure, pass(idxmap) :: g2ls2 => hash_g2ls2 - procedure, pass(idxmap) :: g2lv1 => hash_g2lv1 - procedure, pass(idxmap) :: g2lv2 => hash_g2lv2 + procedure, pass(idxmap) :: lg2ls1 => hash_g2ls1 + procedure, pass(idxmap) :: lg2ls2 => hash_g2ls2 + procedure, pass(idxmap) :: lg2lv1 => hash_g2lv1 + procedure, pass(idxmap) :: lg2lv2 => hash_g2lv2 - procedure, pass(idxmap) :: g2ls1_ins => hash_g2ls1_ins - procedure, pass(idxmap) :: g2ls2_ins => hash_g2ls2_ins - procedure, pass(idxmap) :: g2lv1_ins => hash_g2lv1_ins - procedure, pass(idxmap) :: g2lv2_ins => hash_g2lv2_ins + procedure, pass(idxmap) :: lg2ls1_ins => hash_g2ls1_ins + procedure, pass(idxmap) :: lg2ls2_ins => hash_g2ls2_ins + procedure, pass(idxmap) :: lg2lv1_ins => hash_g2lv1_ins + procedure, pass(idxmap) :: lg2lv2_ins => hash_g2lv2_ins procedure, pass(idxmap) :: hash_cpy generic, public :: assignment(=) => hash_cpy @@ -159,11 +160,11 @@ contains subroutine hash_l2gs1(idx,idxmap,info,mask,owned) implicit none class(psb_hash_map), intent(in) :: idxmap - integer(psb_ipk_), intent(inout) :: idx + integer(psb_lpk_), intent(inout) :: idx integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask logical, intent(in), optional :: owned - integer(psb_ipk_) :: idxv(1) + integer(psb_lpk_) :: idxv(1) info = 0 if (present(mask)) then if (.not.mask) return @@ -179,13 +180,21 @@ contains implicit none class(psb_hash_map), intent(in) :: idxmap integer(psb_ipk_), intent(in) :: idxin - integer(psb_ipk_), intent(out) :: idxout + integer(psb_lpk_), intent(out) :: idxout integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask logical, intent(in), optional :: owned - idxout = idxin - call idxmap%l2gip(idxout,info,mask,owned) + integer(psb_lpk_) :: idxv(1) + info = 0 + if (present(mask)) then + if (.not.mask) return + end if + + idxv(1) = idxin + call idxmap%l2gip(idxv,info,owned=owned) + idxout = idxv(1) + end subroutine hash_l2gs2 @@ -193,7 +202,7 @@ contains subroutine hash_l2gv1(idx,idxmap,info,mask,owned) implicit none class(psb_hash_map), intent(in) :: idxmap - integer(psb_ipk_), intent(inout) :: idx(:) + integer(psb_lpk_), intent(inout) :: idx(:) integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask(:) logical, intent(in), optional :: owned @@ -249,7 +258,7 @@ contains implicit none class(psb_hash_map), intent(in) :: idxmap integer(psb_ipk_), intent(in) :: idxin(:) - integer(psb_ipk_), intent(out) :: idxout(:) + integer(psb_lpk_), intent(out) :: idxout(:) integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask(:) logical, intent(in), optional :: owned @@ -270,11 +279,11 @@ contains subroutine hash_g2ls1(idx,idxmap,info,mask,owned) implicit none class(psb_hash_map), intent(in) :: idxmap - integer(psb_ipk_), intent(inout) :: idx + integer(psb_lpk_), intent(inout) :: idx integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask logical, intent(in), optional :: owned - integer(psb_ipk_) :: idxv(1) + integer(psb_lpk_) :: idxv(1) info = 0 if (present(mask)) then @@ -290,14 +299,21 @@ contains subroutine hash_g2ls2(idxin,idxout,idxmap,info,mask,owned) implicit none class(psb_hash_map), intent(in) :: idxmap - integer(psb_ipk_), intent(in) :: idxin + integer(psb_lpk_), intent(in) :: idxin integer(psb_ipk_), intent(out) :: idxout integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask logical, intent(in), optional :: owned + integer(psb_lpk_) :: idxv(1) + info = 0 - idxout = idxin - call idxmap%g2lip(idxout,info,mask,owned) + if (present(mask)) then + if (.not.mask) return + end if + + idxv(1) = idxin + call idxmap%g2lip(idxv,info,owned=owned) + idxout = idxv(1) end subroutine hash_g2ls2 @@ -307,11 +323,12 @@ contains use psb_sort_mod implicit none class(psb_hash_map), intent(in) :: idxmap - integer(psb_ipk_), intent(inout) :: idx(:) + integer(psb_lpk_), intent(inout) :: idx(:) integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask(:) logical, intent(in), optional :: owned - integer(psb_ipk_) :: i, is, mglob, ip, lip, nrow, ncol, nrm + integer(psb_ipk_) :: i, is, mglob, lip, nrow, nrm + integer(psb_lpk_) :: ncol, ip, tlip integer(psb_mpk_) :: ictxt, iam, np logical :: owned_ @@ -358,8 +375,10 @@ contains cycle endif call hash_inner_cnv(ip,lip,idxmap%hashvmask,idxmap%hashv,idxmap%glb_lc,nrm) - if (lip < 0) & - & call psb_hash_searchkey(ip,lip,idxmap%hash,info) + if (lip < 0) then + call psb_hash_searchkey(ip,tlip,idxmap%hash,info) + lip = tlip + end if if (owned_) then if (lip<=nrow) then idx(i) = lip @@ -394,8 +413,10 @@ contains cycle endif call hash_inner_cnv(ip,lip,idxmap%hashvmask,idxmap%hashv,idxmap%glb_lc,nrm) - if (lip < 0) & - & call psb_hash_searchkey(ip,lip,idxmap%hash,info) + if (lip < 0) then + call psb_hash_searchkey(ip,tlip,idxmap%hash,info) + lip = tlip + end if if (owned_) then if (lip<=nrow) then idx(i) = lip @@ -421,18 +442,20 @@ contains subroutine hash_g2lv2(idxin,idxout,idxmap,info,mask,owned) implicit none class(psb_hash_map), intent(in) :: idxmap - integer(psb_ipk_), intent(in) :: idxin(:) + integer(psb_lpk_), intent(in) :: idxin(:) integer(psb_ipk_), intent(out) :: idxout(:) integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask(:) logical, intent(in), optional :: owned integer(psb_ipk_) :: is, im - + integer(psb_lpk_), allocatable :: tidx(:) is = size(idxin) im = min(is,size(idxout)) - idxout(1:im) = idxin(1:im) - call idxmap%g2lip(idxout(1:im),info,mask,owned) + call psb_realloc(im,tidx,info) + tidx(1:im) = idxin(1:im) + call idxmap%g2lip(tidx(1:im),info,mask,owned) + idxout(1:im) = tidx(1:im) if (is > im) then write(0,*) 'g2lv2 err -3' info = -3 @@ -447,12 +470,13 @@ contains use psb_sort_mod implicit none class(psb_hash_map), intent(inout) :: idxmap - integer(psb_ipk_), intent(inout) :: idx + integer(psb_lpk_), intent(inout) :: idx integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask integer(psb_ipk_), intent(in), optional :: lidx - integer(psb_ipk_) :: idxv(1), lidxv(1) + integer(psb_lpk_) :: idxv(1) + integer(psb_ipk_) :: lidxv(1) info = 0 if (present(mask)) then @@ -473,15 +497,28 @@ contains subroutine hash_g2ls2_ins(idxin,idxout,idxmap,info,mask,lidx) implicit none class(psb_hash_map), intent(inout) :: idxmap - integer(psb_ipk_), intent(in) :: idxin + integer(psb_lpk_), intent(in) :: idxin integer(psb_ipk_), intent(out) :: idxout integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask integer(psb_ipk_), intent(in), optional :: lidx + integer(psb_lpk_) :: idxv(1) + integer(psb_ipk_) :: lidxv(1) + + info = 0 + if (present(mask)) then + if (.not.mask) return + end if - idxout = idxin - call idxmap%g2lip_ins(idxout,info,mask=mask,lidx=lidx) + idxv(1) = idxin + if (present(lidx)) then + lidxv(1) = lidx + call idxmap%g2lip_ins(idxv,info,lidx=lidxv) + else + call idxmap%g2lip_ins(idxv,info) + end if + idxout = idxv(1) end subroutine hash_g2ls2_ins @@ -493,13 +530,14 @@ contains use psb_penv_mod implicit none class(psb_hash_map), intent(inout) :: idxmap - integer(psb_ipk_), intent(inout) :: idx(:) + integer(psb_lpk_), intent(inout) :: idx(:) integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask(:) integer(psb_ipk_), intent(in), optional :: lidx(:) - integer(psb_ipk_) :: i, is, mglob, ip, lip, nrow, ncol, & - & nxt, err_act + integer(psb_ipk_) :: i, is, lip, nrow, ncol, & + & err_act + integer(psb_lpk_) :: mglob, ip, nxt, tlip integer(psb_ipk_) :: ictxt, me, np character(len=20) :: name,ch_err @@ -540,18 +578,20 @@ contains idx(i) = -1 cycle endif - call hash_inner_cnv(ip,lip,idxmap%hashvmask,idxmap%hashv,idxmap%glb_lc,ncol) - if (lip < 0) then + call hash_inner_cnv(ip,lip,idxmap%hashvmask,& + & idxmap%hashv,idxmap%glb_lc,ncol) + if (lip < 0) then + tlip = lip nxt = lidx(i) if (nxt <= nrow) then idx(i) = -1 cycle endif - call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) + call psb_hash_searchinskey(ip,tlip,nxt,idxmap%hash,info) if (info >=0) then - if (nxt == lip) then + if (nxt == tlip) then ncol = max(ncol,nxt) - call psb_ensure_size(ncol,idxmap%loc_to_glob,info,pad=-ione,addsz=laddsz) + call psb_ensure_size(ncol,idxmap%loc_to_glob,info,pad=-1_psb_lpk_,addsz=laddsz) if (info /= psb_success_) then info=1 ch_err='psb_ensure_size' @@ -593,12 +633,13 @@ contains idx(i) = -1 cycle endif - call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) - + call psb_hash_searchinskey(ip,tlip,nxt,idxmap%hash,info) + lip = tlip + if (info >=0) then if (nxt == lip) then ncol = max(nxt,ncol) - call psb_ensure_size(ncol,idxmap%loc_to_glob,info,pad=-ione,addsz=laddsz) + call psb_ensure_size(ncol,idxmap%loc_to_glob,info,pad=-1_psb_lpk_,addsz=laddsz) if (info /= psb_success_) then info=1 ch_err='psb_ensure_size' @@ -636,13 +677,15 @@ contains endif nxt = ncol + 1 call hash_inner_cnv(ip,lip,idxmap%hashvmask,idxmap%hashv,idxmap%glb_lc,ncol) - if (lip < 0) & - & call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) + if (lip < 0) then + call psb_hash_searchinskey(ip,tlip,nxt,idxmap%hash,info) + lip = tlip + end if if (info >=0) then if (nxt == lip) then ncol = nxt - call psb_ensure_size(ncol,idxmap%loc_to_glob,info,pad=-ione,addsz=laddsz) + call psb_ensure_size(ncol,idxmap%loc_to_glob,info,pad=-1_psb_lpk_,addsz=laddsz) if (info /= psb_success_) then info=1 ch_err='psb_ensure_size' @@ -678,13 +721,15 @@ contains endif nxt = ncol + 1 call hash_inner_cnv(ip,lip,idxmap%hashvmask,idxmap%hashv,idxmap%glb_lc,ncol) - if (lip < 0) & - & call psb_hash_searchinskey(ip,lip,nxt,idxmap%hash,info) + if (lip < 0) then + call psb_hash_searchinskey(ip,tlip,nxt,idxmap%hash,info) + lip = tlip + end if if (info >=0) then if (nxt == lip) then ncol = nxt - call psb_ensure_size(ncol,idxmap%loc_to_glob,info,pad=-ione,addsz=laddsz) + call psb_ensure_size(ncol,idxmap%loc_to_glob,info,pad=-1_psb_lpk_,addsz=laddsz) if (info /= psb_success_) then info=1 ch_err='psb_ensure_size' @@ -726,18 +771,20 @@ contains subroutine hash_g2lv2_ins(idxin,idxout,idxmap,info,mask,lidx) implicit none class(psb_hash_map), intent(inout) :: idxmap - integer(psb_ipk_), intent(in) :: idxin(:) + integer(psb_lpk_), intent(in) :: idxin(:) integer(psb_ipk_), intent(out) :: idxout(:) integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask(:) integer(psb_ipk_), intent(in), optional :: lidx(:) - + integer(psb_lpk_), allocatable :: tidx(:) integer(psb_ipk_) :: is, im is = size(idxin) im = min(is,size(idxout)) - idxout(1:im) = idxin(1:im) - call idxmap%g2lip_ins(idxout(1:im),info,mask=mask,lidx=lidx) + call psb_realloc(im,tidx,info) + tidx(1:im) = idxin(1:im) + call idxmap%g2lip_ins(tidx(1:im),info,mask=mask,lidx=lidx) + idxout(1:im) = tidx(1:im) if (is > im) then write(0,*) 'g2lv2_ins err -3' info = -3 @@ -756,12 +803,14 @@ contains implicit none class(psb_hash_map), intent(inout) :: idxmap integer(psb_mpk_), intent(in) :: ictxt - integer(psb_ipk_), intent(in) :: vl(:) + integer(psb_lpk_), intent(in) :: vl(:) integer(psb_ipk_), intent(out) :: info ! To be implemented integer(psb_mpk_) :: iam, np - integer(psb_ipk_) :: i, nlu, nl, m, nrt,int_err(5) - integer(psb_ipk_), allocatable :: vlu(:), ix(:) + integer(psb_ipk_) :: i, nlu, nl, nrt,int_err(5) + integer(psb_lpk_) :: m + integer(psb_lpk_), allocatable :: vlu(:) + integer(psb_lpk_), allocatable :: ix(:) character(len=20), parameter :: name='hash_map_init_vl' info = 0 @@ -831,8 +880,9 @@ contains integer(psb_ipk_), intent(out) :: info ! To be implemented integer(psb_mpk_) :: iam, np - integer(psb_ipk_) :: i, j, nl, n, int_err(5) - integer(psb_ipk_), allocatable :: vlu(:) + integer(psb_ipk_) :: i, j, nl, int_err(5) + integer(psb_lpk_) :: n + integer(psb_lpk_), allocatable :: vlu(:) info = 0 call psb_info(ictxt,iam,np) @@ -886,7 +936,8 @@ contains implicit none class(psb_hash_map), intent(inout) :: idxmap integer(psb_mpk_), intent(in) :: ictxt - integer(psb_ipk_), intent(in) :: vlu(:), nl, ntot + integer(psb_lpk_), intent(in) :: vlu(:), ntot + integer(psb_ipk_), intent(in) :: nl integer(psb_ipk_), intent(out) :: info ! To be implemented integer(psb_mpk_) :: iam, np @@ -1127,8 +1178,8 @@ contains end subroutine hash_inner_cnvs1 subroutine hash_inner_cnvs2(x,y,hashmask,hashv,glb_lc,nrm) - integer(psb_ipk_), intent(in) :: hashmask,hashv(0:),glb_lc(:,:) - integer(psb_ipk_), intent(in) :: x + integer(psb_ipk_), intent(in) :: hashmask,hashv(0:) + integer(psb_lpk_), intent(in) :: x, glb_lc(:,:) integer(psb_ipk_), intent(out) :: y integer(psb_ipk_), intent(in) :: nrm integer(psb_ipk_) :: ih, key, idx,nh,tmp,lb,ub,lm @@ -1175,10 +1226,11 @@ contains subroutine hash_inner_cnv1(n,x,hashmask,hashv,glb_lc,mask,nrm) - integer(psb_ipk_), intent(in) :: n,hashmask,hashv(0:),glb_lc(:,:) + integer(psb_ipk_), intent(in) :: n,hashmask,hashv(0:) + integer(psb_lpk_), intent(in) :: glb_lc(:,:) logical, intent(in), optional :: mask(:) integer(psb_ipk_), intent(in), optional :: nrm - integer(psb_ipk_), intent(inout) :: x(:) + integer(psb_lpk_), intent(inout) :: x(:) integer(psb_ipk_) :: i, ih, key, idx,nh,tmp,lb,ub,lm ! @@ -1460,9 +1512,11 @@ contains implicit none class(psb_hash_map), intent(inout) :: idxmap integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: err_act, nr,nc,k, nl, ntot + integer(psb_ipk_) :: err_act, nr,nc,k, nl + integer(psb_lpk_) :: ntot integer(psb_mpk_) :: ictxt, me, np - integer(psb_ipk_), allocatable :: idx(:),lidx(:) + integer(psb_ipk_), allocatable :: lidx(:) + integer(psb_lpk_), allocatable :: idx(:) character(len=20) :: name='hash_reinit' logical, parameter :: debug=.false. diff --git a/base/modules/desc/psb_indx_map_mod.f90 b/base/modules/desc/psb_indx_map_mod.f90 index 27935eac..7ceb42de 100644 --- a/base/modules/desc/psb_indx_map_mod.f90 +++ b/base/modules/desc/psb_indx_map_mod.f90 @@ -167,38 +167,44 @@ module psb_indx_map_mod procedure, pass(idxmap) :: clone => base_clone procedure, pass(idxmap) :: reinit => base_reinit - procedure, pass(idxmap) :: l2gs1 => base_l2gs1 - procedure, pass(idxmap) :: l2gs2 => base_l2gs2 - procedure, pass(idxmap) :: l2gv1 => base_l2gv1 - procedure, pass(idxmap) :: l2gv2 => base_l2gv2 +!!$ procedure, pass(idxmap) :: l2gs1 => base_l2gs1 +!!$ procedure, pass(idxmap) :: l2gs2 => base_l2gs2 +!!$ procedure, pass(idxmap) :: l2gv1 => base_l2gv1 +!!$ procedure, pass(idxmap) :: l2gv2 => base_l2gv2 procedure, pass(idxmap) :: ll2gs1 => base_ll2gs1 procedure, pass(idxmap) :: ll2gs2 => base_ll2gs2 procedure, pass(idxmap) :: ll2gv1 => base_ll2gv1 procedure, pass(idxmap) :: ll2gv2 => base_ll2gv2 - generic, public :: l2g => l2gs2, l2gv2, ll2gs2, ll2gv2 - generic, public :: l2gip => l2gs1, l2gv1, ll2gs1, ll2gv1 - - procedure, pass(idxmap) :: g2ls1 => base_g2ls1 - procedure, pass(idxmap) :: g2ls2 => base_g2ls2 - procedure, pass(idxmap) :: g2lv1 => base_g2lv1 - procedure, pass(idxmap) :: g2lv2 => base_g2lv2 +!!$ generic, public :: l2g => l2gs2, l2gv2 +!!$ generic, public :: l2gip => l2gs1, l2gv1 + generic, public :: l2g => ll2gs2, ll2gv2 + generic, public :: l2gip => ll2gs1, ll2gv1 + +!!$ procedure, pass(idxmap) :: g2ls1 => base_g2ls1 +!!$ procedure, pass(idxmap) :: g2ls2 => base_g2ls2 +!!$ procedure, pass(idxmap) :: g2lv1 => base_g2lv1 +!!$ procedure, pass(idxmap) :: g2lv2 => base_g2lv2 procedure, pass(idxmap) :: lg2ls1 => base_lg2ls1 procedure, pass(idxmap) :: lg2ls2 => base_lg2ls2 procedure, pass(idxmap) :: lg2lv1 => base_lg2lv1 procedure, pass(idxmap) :: lg2lv2 => base_lg2lv2 - generic, public :: g2l => g2ls2, g2lv2, lg2ls2, lg2lv2 - generic, public :: g2lip => g2ls1, g2lv1, lg2ls1, lg2lv1 - - procedure, pass(idxmap) :: g2ls1_ins => base_g2ls1_ins - procedure, pass(idxmap) :: g2ls2_ins => base_g2ls2_ins - procedure, pass(idxmap) :: g2lv1_ins => base_g2lv1_ins - procedure, pass(idxmap) :: g2lv2_ins => base_g2lv2_ins +!!$ generic, public :: g2l => g2ls2, g2lv2 +!!$ generic, public :: g2lip => g2ls1, g2lv1 + generic, public :: g2l => lg2ls2, lg2lv2 + generic, public :: g2lip => lg2ls1, lg2lv1 + +!!$ procedure, pass(idxmap) :: g2ls1_ins => base_g2ls1_ins +!!$ procedure, pass(idxmap) :: g2ls2_ins => base_g2ls2_ins +!!$ procedure, pass(idxmap) :: g2lv1_ins => base_g2lv1_ins +!!$ procedure, pass(idxmap) :: g2lv2_ins => base_g2lv2_ins procedure, pass(idxmap) :: lg2ls1_ins => base_lg2ls1_ins procedure, pass(idxmap) :: lg2ls2_ins => base_lg2ls2_ins procedure, pass(idxmap) :: lg2lv1_ins => base_lg2lv1_ins procedure, pass(idxmap) :: lg2lv2_ins => base_lg2lv2_ins - generic, public :: g2l_ins => g2ls2_ins, g2lv2_ins, lg2ls2_ins, lg2lv2_ins - generic, public :: g2lip_ins => g2ls1_ins, g2lv1_ins, lg2ls1_ins, lg2lv1_ins +!!$ generic, public :: g2l_ins => g2ls2_ins, g2lv2_ins +!!$ generic, public :: g2lip_ins => g2ls1_ins, g2lv1_ins + generic, public :: g2l_ins => lg2ls2_ins, lg2lv2_ins + generic, public :: g2lip_ins => lg2ls1_ins, lg2lv1_ins procedure, pass(idxmap) :: fnd_owner => psb_indx_map_fnd_owner procedure, pass(idxmap) :: init_vl => base_init_vl @@ -242,9 +248,9 @@ module psb_indx_map_mod interface subroutine psb_indx_map_fnd_owner(idx,iprc,idxmap,info) - import :: psb_indx_map, psb_ipk_ + import :: psb_indx_map, psb_ipk_, psb_lpk_ implicit none - integer(psb_ipk_), intent(in) :: idx(:) + integer(psb_lpk_), intent(in) :: idx(:) integer(psb_ipk_), allocatable, intent(out) :: iprc(:) class(psb_indx_map), intent(in) :: idxmap integer(psb_ipk_), intent(out) :: info @@ -1150,7 +1156,7 @@ contains implicit none class(psb_indx_map), intent(inout) :: idxmap integer(psb_mpk_), intent(in) :: ictxt - integer(psb_ipk_), intent(in) :: vl(:) + integer(psb_lpk_), intent(in) :: vl(:) integer(psb_ipk_), intent(out) :: info integer(psb_ipk_) :: err_act character(len=20) :: name='base_init_vl' diff --git a/base/modules/desc/psb_list_map_mod.f90 b/base/modules/desc/psb_list_map_mod.f90 index cfa41400..1256d78e 100644 --- a/base/modules/desc/psb_list_map_mod.f90 +++ b/base/modules/desc/psb_list_map_mod.f90 @@ -49,9 +49,7 @@ module psb_list_map_mod integer(psb_lpk_), allocatable :: loc_to_glob(:) integer(psb_ipk_), allocatable :: glob_to_loc(:) contains - procedure, pass(idxmap) :: init_vl => list_initvl - - procedure, pass(idxmap) :: init_lvl => list_initlvl + procedure, pass(idxmap) :: init_vl => list_initlvl procedure, pass(idxmap) :: sizeof => list_sizeof procedure, pass(idxmap) :: asb => list_asb @@ -61,30 +59,30 @@ module psb_list_map_mod procedure, nopass :: get_fmt => list_get_fmt procedure, nopass :: row_extendable => list_row_extendable - procedure, pass(idxmap) :: l2gs1 => list_l2gs1 - procedure, pass(idxmap) :: l2gs2 => list_l2gs2 - procedure, pass(idxmap) :: l2gv1 => list_l2gv1 - procedure, pass(idxmap) :: l2gv2 => list_l2gv2 +!!$ procedure, pass(idxmap) :: l2gs1 => list_l2gs1 +!!$ procedure, pass(idxmap) :: l2gs2 => list_l2gs2 +!!$ procedure, pass(idxmap) :: l2gv1 => list_l2gv1 +!!$ procedure, pass(idxmap) :: l2gv2 => list_l2gv2 procedure, pass(idxmap) :: ll2gs1 => list_ll2gs1 procedure, pass(idxmap) :: ll2gs2 => list_ll2gs2 procedure, pass(idxmap) :: ll2gv1 => list_ll2gv1 procedure, pass(idxmap) :: ll2gv2 => list_ll2gv2 - procedure, pass(idxmap) :: g2ls1 => list_g2ls1 - procedure, pass(idxmap) :: g2ls2 => list_g2ls2 - procedure, pass(idxmap) :: g2lv1 => list_g2lv1 - procedure, pass(idxmap) :: g2lv2 => list_g2lv2 +!!$ procedure, pass(idxmap) :: g2ls1 => list_g2ls1 +!!$ procedure, pass(idxmap) :: g2ls2 => list_g2ls2 +!!$ procedure, pass(idxmap) :: g2lv1 => list_g2lv1 +!!$ procedure, pass(idxmap) :: g2lv2 => list_g2lv2 procedure, pass(idxmap) :: lg2ls1 => list_lg2ls1 procedure, pass(idxmap) :: lg2ls2 => list_lg2ls2 procedure, pass(idxmap) :: lg2lv1 => list_lg2lv1 procedure, pass(idxmap) :: lg2lv2 => list_lg2lv2 - procedure, pass(idxmap) :: g2ls1_ins => list_g2ls1_ins - procedure, pass(idxmap) :: g2ls2_ins => list_g2ls2_ins - procedure, pass(idxmap) :: g2lv1_ins => list_g2lv1_ins - procedure, pass(idxmap) :: g2lv2_ins => list_g2lv2_ins +!!$ procedure, pass(idxmap) :: g2ls1_ins => list_g2ls1_ins +!!$ procedure, pass(idxmap) :: g2ls2_ins => list_g2ls2_ins +!!$ procedure, pass(idxmap) :: g2lv1_ins => list_g2lv1_ins +!!$ procedure, pass(idxmap) :: g2lv2_ins => list_g2lv2_ins procedure, pass(idxmap) :: lg2ls1_ins => list_lg2ls1_ins procedure, pass(idxmap) :: lg2ls2_ins => list_lg2ls2_ins @@ -138,113 +136,113 @@ contains end subroutine list_free - subroutine list_l2gs1(idx,idxmap,info,mask,owned) - implicit none - class(psb_list_map), intent(in) :: idxmap - integer(psb_ipk_), intent(inout) :: idx - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask - logical, intent(in), optional :: owned - integer(psb_ipk_) :: idxv(1) - info = 0 - if (present(mask)) then - if (.not.mask) return - end if - - idxv(1) = idx - call idxmap%l2gip(idxv,info,owned=owned) - idx = idxv(1) - - end subroutine list_l2gs1 - - subroutine list_l2gs2(idxin,idxout,idxmap,info,mask,owned) - implicit none - class(psb_list_map), intent(in) :: idxmap - integer(psb_ipk_), intent(in) :: idxin - integer(psb_ipk_), intent(out) :: idxout - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask - logical, intent(in), optional :: owned - - idxout = idxin - call idxmap%l2gip(idxout,info,mask,owned) - - end subroutine list_l2gs2 - - - subroutine list_l2gv1(idx,idxmap,info,mask,owned) - implicit none - class(psb_list_map), intent(in) :: idxmap - integer(psb_ipk_), intent(inout) :: idx(:) - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask(:) - logical, intent(in), optional :: owned - integer(psb_ipk_) :: i - logical :: owned_ - info = 0 - - if (present(mask)) then - if (size(mask) < size(idx)) then - info = -1 - return - end if - end if - if (present(owned)) then - owned_ = owned - else - owned_ = .false. - end if - - if (present(mask)) then - - do i=1, size(idx) - if (mask(i)) then - if ((1<=idx(i)).and.(idx(i) <= idxmap%get_lr())) then - idx(i) = idxmap%loc_to_glob(idx(i)) - else if ((idxmap%get_lr() < idx(i)).and.(idx(i) <= idxmap%local_cols)& - & .and.(.not.owned_)) then - idx(i) = idxmap%loc_to_glob(idx(i)) - else - idx(i) = -1 - end if - end if - end do - - else if (.not.present(mask)) then - - do i=1, size(idx) - if ((1<=idx(i)).and.(idx(i) <= idxmap%get_lr())) then - idx(i) = idxmap%loc_to_glob(idx(i)) - else if ((idxmap%get_lr() < idx(i)).and.(idx(i) <= idxmap%local_cols)& - & .and.(.not.owned_)) then - idx(i) = idxmap%loc_to_glob(idx(i)) - else - idx(i) = -1 - end if - end do - - end if - - end subroutine list_l2gv1 - - subroutine list_l2gv2(idxin,idxout,idxmap,info,mask,owned) - implicit none - class(psb_list_map), intent(in) :: idxmap - integer(psb_ipk_), intent(in) :: idxin(:) - integer(psb_ipk_), intent(out) :: idxout(:) - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask(:) - logical, intent(in), optional :: owned - integer(psb_ipk_) :: is, im - - is = size(idxin) - im = min(is,size(idxout)) - idxout(1:im) = idxin(1:im) - call idxmap%l2gip(idxout(1:im),info,mask,owned) - if (is > im) info = -3 - - end subroutine list_l2gv2 - +!!$ subroutine list_l2gs1(idx,idxmap,info,mask,owned) +!!$ implicit none +!!$ class(psb_list_map), intent(in) :: idxmap +!!$ integer(psb_ipk_), intent(inout) :: idx +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask +!!$ logical, intent(in), optional :: owned +!!$ integer(psb_ipk_) :: idxv(1) +!!$ info = 0 +!!$ if (present(mask)) then +!!$ if (.not.mask) return +!!$ end if +!!$ +!!$ idxv(1) = idx +!!$ call idxmap%l2gip(idxv,info,owned=owned) +!!$ idx = idxv(1) +!!$ +!!$ end subroutine list_l2gs1 +!!$ +!!$ subroutine list_l2gs2(idxin,idxout,idxmap,info,mask,owned) +!!$ implicit none +!!$ class(psb_list_map), intent(in) :: idxmap +!!$ integer(psb_ipk_), intent(in) :: idxin +!!$ integer(psb_ipk_), intent(out) :: idxout +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask +!!$ logical, intent(in), optional :: owned +!!$ +!!$ idxout = idxin +!!$ call idxmap%l2gip(idxout,info,mask,owned) +!!$ +!!$ end subroutine list_l2gs2 +!!$ +!!$ +!!$ subroutine list_l2gv1(idx,idxmap,info,mask,owned) +!!$ implicit none +!!$ class(psb_list_map), intent(in) :: idxmap +!!$ integer(psb_ipk_), intent(inout) :: idx(:) +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask(:) +!!$ logical, intent(in), optional :: owned +!!$ integer(psb_ipk_) :: i +!!$ logical :: owned_ +!!$ info = 0 +!!$ +!!$ if (present(mask)) then +!!$ if (size(mask) < size(idx)) then +!!$ info = -1 +!!$ return +!!$ end if +!!$ end if +!!$ if (present(owned)) then +!!$ owned_ = owned +!!$ else +!!$ owned_ = .false. +!!$ end if +!!$ +!!$ if (present(mask)) then +!!$ +!!$ do i=1, size(idx) +!!$ if (mask(i)) then +!!$ if ((1<=idx(i)).and.(idx(i) <= idxmap%get_lr())) then +!!$ idx(i) = idxmap%loc_to_glob(idx(i)) +!!$ else if ((idxmap%get_lr() < idx(i)).and.(idx(i) <= idxmap%local_cols)& +!!$ & .and.(.not.owned_)) then +!!$ idx(i) = idxmap%loc_to_glob(idx(i)) +!!$ else +!!$ idx(i) = -1 +!!$ end if +!!$ end if +!!$ end do +!!$ +!!$ else if (.not.present(mask)) then +!!$ +!!$ do i=1, size(idx) +!!$ if ((1<=idx(i)).and.(idx(i) <= idxmap%get_lr())) then +!!$ idx(i) = idxmap%loc_to_glob(idx(i)) +!!$ else if ((idxmap%get_lr() < idx(i)).and.(idx(i) <= idxmap%local_cols)& +!!$ & .and.(.not.owned_)) then +!!$ idx(i) = idxmap%loc_to_glob(idx(i)) +!!$ else +!!$ idx(i) = -1 +!!$ end if +!!$ end do +!!$ +!!$ end if +!!$ +!!$ end subroutine list_l2gv1 +!!$ +!!$ subroutine list_l2gv2(idxin,idxout,idxmap,info,mask,owned) +!!$ implicit none +!!$ class(psb_list_map), intent(in) :: idxmap +!!$ integer(psb_ipk_), intent(in) :: idxin(:) +!!$ integer(psb_ipk_), intent(out) :: idxout(:) +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask(:) +!!$ logical, intent(in), optional :: owned +!!$ integer(psb_ipk_) :: is, im +!!$ +!!$ is = size(idxin) +!!$ im = min(is,size(idxout)) +!!$ idxout(1:im) = idxin(1:im) +!!$ call idxmap%l2gip(idxout(1:im),info,mask,owned) +!!$ if (is > im) info = -3 +!!$ +!!$ end subroutine list_l2gv2 +!!$ subroutine list_ll2gs1(idx,idxmap,info,mask,owned) implicit none @@ -353,126 +351,126 @@ contains end subroutine list_ll2gv2 - - subroutine list_g2ls1(idx,idxmap,info,mask,owned) - implicit none - class(psb_list_map), intent(in) :: idxmap - integer(psb_ipk_), intent(inout) :: idx - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask - logical, intent(in), optional :: owned - integer(psb_ipk_) :: idxv(1) - info = 0 - - if (present(mask)) then - if (.not.mask) return - end if - - idxv(1) = idx - call idxmap%g2lip(idxv,info,owned=owned) - idx = idxv(1) - - end subroutine list_g2ls1 - - subroutine list_g2ls2(idxin,idxout,idxmap,info,mask,owned) - implicit none - class(psb_list_map), intent(in) :: idxmap - integer(psb_ipk_), intent(in) :: idxin - integer(psb_ipk_), intent(out) :: idxout - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask - logical, intent(in), optional :: owned - - idxout = idxin - call idxmap%g2lip(idxout,info,mask,owned) - - end subroutine list_g2ls2 - - - subroutine list_g2lv1(idx,idxmap,info,mask,owned) - use psb_sort_mod - implicit none - class(psb_list_map), intent(in) :: idxmap - integer(psb_ipk_), intent(inout) :: idx(:) - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask(:) - logical, intent(in), optional :: owned - integer(psb_ipk_) :: i, is, ix - logical :: owned_ - - info = 0 - - if (present(mask)) then - if (size(mask) < size(idx)) then - info = -1 - return - end if - end if - if (present(owned)) then - owned_ = owned - else - owned_ = .false. - end if - - is = size(idx) - - if (present(mask)) then - if (idxmap%is_valid()) then - do i=1,is - if (mask(i)) then - if ((1 <= idx(i)).and.(idx(i) <= idxmap%global_rows)) then - ix = idxmap%glob_to_loc(idx(i)) - if ((ix > idxmap%get_lr()).and.(owned_)) ix = -1 - idx(i) = ix - else - idx(i) = -1 - end if - end if - end do - else - idx(1:is) = -1 - info = -1 - end if - - else if (.not.present(mask)) then - - if (idxmap%is_valid()) then - do i=1, is - if ((1 <= idx(i)).and.(idx(i) <= idxmap%global_rows)) then - ix = idxmap%glob_to_loc(idx(i)) - if ((ix > idxmap%get_lr()).and.(owned_)) ix = -1 - idx(i) = ix - else - idx(i) = -1 - end if - end do - else - idx(1:is) = -1 - info = -1 - end if - - end if - - end subroutine list_g2lv1 - - subroutine list_g2lv2(idxin,idxout,idxmap,info,mask,owned) - implicit none - class(psb_list_map), intent(in) :: idxmap - integer(psb_ipk_), intent(in) :: idxin(:) - integer(psb_ipk_), intent(out) :: idxout(:) - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask(:) - logical, intent(in), optional :: owned - - integer(psb_ipk_) :: is, im - - is = size(idxin) - im = min(is,size(idxout)) - idxout(1:im) = idxin(1:im) - call idxmap%g2lip(idxout(1:im),info,mask,owned) - if (is > im) info = -3 - - end subroutine list_g2lv2 +!!$ +!!$ subroutine list_g2ls1(idx,idxmap,info,mask,owned) +!!$ implicit none +!!$ class(psb_list_map), intent(in) :: idxmap +!!$ integer(psb_ipk_), intent(inout) :: idx +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask +!!$ logical, intent(in), optional :: owned +!!$ integer(psb_ipk_) :: idxv(1) +!!$ info = 0 +!!$ +!!$ if (present(mask)) then +!!$ if (.not.mask) return +!!$ end if +!!$ +!!$ idxv(1) = idx +!!$ call idxmap%g2lip(idxv,info,owned=owned) +!!$ idx = idxv(1) +!!$ +!!$ end subroutine list_g2ls1 +!!$ +!!$ subroutine list_g2ls2(idxin,idxout,idxmap,info,mask,owned) +!!$ implicit none +!!$ class(psb_list_map), intent(in) :: idxmap +!!$ integer(psb_ipk_), intent(in) :: idxin +!!$ integer(psb_ipk_), intent(out) :: idxout +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask +!!$ logical, intent(in), optional :: owned +!!$ +!!$ idxout = idxin +!!$ call idxmap%g2lip(idxout,info,mask,owned) +!!$ +!!$ end subroutine list_g2ls2 +!!$ +!!$ +!!$ subroutine list_g2lv1(idx,idxmap,info,mask,owned) +!!$ use psb_sort_mod +!!$ implicit none +!!$ class(psb_list_map), intent(in) :: idxmap +!!$ integer(psb_ipk_), intent(inout) :: idx(:) +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask(:) +!!$ logical, intent(in), optional :: owned +!!$ integer(psb_ipk_) :: i, is, ix +!!$ logical :: owned_ +!!$ +!!$ info = 0 +!!$ +!!$ if (present(mask)) then +!!$ if (size(mask) < size(idx)) then +!!$ info = -1 +!!$ return +!!$ end if +!!$ end if +!!$ if (present(owned)) then +!!$ owned_ = owned +!!$ else +!!$ owned_ = .false. +!!$ end if +!!$ +!!$ is = size(idx) +!!$ +!!$ if (present(mask)) then +!!$ if (idxmap%is_valid()) then +!!$ do i=1,is +!!$ if (mask(i)) then +!!$ if ((1 <= idx(i)).and.(idx(i) <= idxmap%global_rows)) then +!!$ ix = idxmap%glob_to_loc(idx(i)) +!!$ if ((ix > idxmap%get_lr()).and.(owned_)) ix = -1 +!!$ idx(i) = ix +!!$ else +!!$ idx(i) = -1 +!!$ end if +!!$ end if +!!$ end do +!!$ else +!!$ idx(1:is) = -1 +!!$ info = -1 +!!$ end if +!!$ +!!$ else if (.not.present(mask)) then +!!$ +!!$ if (idxmap%is_valid()) then +!!$ do i=1, is +!!$ if ((1 <= idx(i)).and.(idx(i) <= idxmap%global_rows)) then +!!$ ix = idxmap%glob_to_loc(idx(i)) +!!$ if ((ix > idxmap%get_lr()).and.(owned_)) ix = -1 +!!$ idx(i) = ix +!!$ else +!!$ idx(i) = -1 +!!$ end if +!!$ end do +!!$ else +!!$ idx(1:is) = -1 +!!$ info = -1 +!!$ end if +!!$ +!!$ end if +!!$ +!!$ end subroutine list_g2lv1 +!!$ +!!$ subroutine list_g2lv2(idxin,idxout,idxmap,info,mask,owned) +!!$ implicit none +!!$ class(psb_list_map), intent(in) :: idxmap +!!$ integer(psb_ipk_), intent(in) :: idxin(:) +!!$ integer(psb_ipk_), intent(out) :: idxout(:) +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask(:) +!!$ logical, intent(in), optional :: owned +!!$ +!!$ integer(psb_ipk_) :: is, im +!!$ +!!$ is = size(idxin) +!!$ im = min(is,size(idxout)) +!!$ idxout(1:im) = idxin(1:im) +!!$ call idxmap%g2lip(idxout(1:im),info,mask,owned) +!!$ if (is > im) info = -3 +!!$ +!!$ end subroutine list_g2lv2 @@ -610,18 +608,221 @@ contains end subroutine list_lg2lv2 +!!$ subroutine list_g2ls1_ins(idx,idxmap,info,mask,lidx) +!!$ use psb_realloc_mod +!!$ use psb_sort_mod +!!$ implicit none +!!$ class(psb_list_map), intent(inout) :: idxmap +!!$ integer(psb_ipk_), intent(inout) :: idx +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask +!!$ integer(psb_ipk_), intent(in), optional :: lidx +!!$ +!!$ integer(psb_ipk_) :: idxv(1), lidxv(1) +!!$ +!!$ info = 0 +!!$ if (present(mask)) then +!!$ if (.not.mask) return +!!$ end if +!!$ idxv(1) = idx +!!$ if (present(lidx)) then +!!$ lidxv(1) = lidx +!!$ call idxmap%g2lip_ins(idxv,info,lidx=lidxv) +!!$ else +!!$ call idxmap%g2lip_ins(idxv,info) +!!$ end if +!!$ +!!$ idx = idxv(1) +!!$ +!!$ end subroutine list_g2ls1_ins +!!$ +!!$ subroutine list_g2ls2_ins(idxin,idxout,idxmap,info,mask,lidx) +!!$ implicit none +!!$ class(psb_list_map), intent(inout) :: idxmap +!!$ integer(psb_ipk_), intent(in) :: idxin +!!$ integer(psb_ipk_), intent(out) :: idxout +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask +!!$ integer(psb_ipk_), intent(in), optional :: lidx +!!$ +!!$ idxout = idxin +!!$ call idxmap%g2lip_ins(idxout,info,mask=mask,lidx=lidx) +!!$ +!!$ end subroutine list_g2ls2_ins +!!$ +!!$ +!!$ subroutine list_g2lv1_ins(idx,idxmap,info,mask,lidx) +!!$ use psb_realloc_mod +!!$ use psb_sort_mod +!!$ implicit none +!!$ class(psb_list_map), intent(inout) :: idxmap +!!$ integer(psb_ipk_), intent(inout) :: idx(:) +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask(:) +!!$ integer(psb_ipk_), intent(in), optional :: lidx(:) +!!$ +!!$ integer(psb_ipk_) :: i, is, ix, lix +!!$ +!!$ info = 0 +!!$ is = size(idx) +!!$ +!!$ if (present(mask)) then +!!$ if (size(mask) < size(idx)) then +!!$ info = -1 +!!$ return +!!$ end if +!!$ end if +!!$ if (present(lidx)) then +!!$ if (size(lidx) < size(idx)) then +!!$ info = -1 +!!$ return +!!$ end if +!!$ end if +!!$ +!!$ +!!$ if (idxmap%is_asb()) then +!!$ ! State is wrong for this one ! +!!$ idx = -1 +!!$ info = -1 +!!$ +!!$ else if (idxmap%is_valid()) then +!!$ +!!$ if (present(lidx)) then +!!$ if (present(mask)) then +!!$ do i=1, is +!!$ if (mask(i)) then +!!$ if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then +!!$ ix = idxmap%glob_to_loc(idx(i)) +!!$ if (ix < 0) then +!!$ ix = lidx(i) +!!$ call psb_ensure_size(ix,idxmap%loc_to_glob,info,addsz=laddsz) +!!$ if ((ix <= idxmap%local_rows).or.(info /= 0)) then +!!$ info = -4 +!!$ return +!!$ end if +!!$ idxmap%local_cols = max(ix,idxmap%local_cols) +!!$ idxmap%loc_to_glob(ix) = idx(i) +!!$ idxmap%glob_to_loc(idx(i)) = ix +!!$ end if +!!$ idx(i) = ix +!!$ else +!!$ idx(i) = -1 +!!$ end if +!!$ end if +!!$ end do +!!$ +!!$ else if (.not.present(mask)) then +!!$ +!!$ do i=1, is +!!$ if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then +!!$ ix = idxmap%glob_to_loc(idx(i)) +!!$ if (ix < 0) then +!!$ ix = lidx(i) +!!$ call psb_ensure_size(ix,idxmap%loc_to_glob,info,addsz=laddsz) +!!$ if ((ix <= idxmap%local_rows).or.(info /= 0)) then +!!$ info = -4 +!!$ return +!!$ end if +!!$ idxmap%local_cols = max(ix,idxmap%local_cols) +!!$ idxmap%loc_to_glob(ix) = idx(i) +!!$ idxmap%glob_to_loc(idx(i)) = ix +!!$ end if +!!$ idx(i) = ix +!!$ else +!!$ idx(i) = -1 +!!$ end if +!!$ end do +!!$ end if +!!$ +!!$ else if (.not.present(lidx)) then +!!$ +!!$ if (present(mask)) then +!!$ do i=1, is +!!$ if (mask(i)) then +!!$ if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then +!!$ ix = idxmap%glob_to_loc(idx(i)) +!!$ if (ix < 0) then +!!$ ix = idxmap%local_cols + 1 +!!$ call psb_ensure_size(ix,idxmap%loc_to_glob,info,addsz=laddsz) +!!$ if (info /= 0) then +!!$ info = -4 +!!$ return +!!$ end if +!!$ idxmap%local_cols = ix +!!$ idxmap%loc_to_glob(ix) = idx(i) +!!$ idxmap%glob_to_loc(idx(i)) = ix +!!$ end if +!!$ idx(i) = ix +!!$ else +!!$ idx(i) = -1 +!!$ end if +!!$ end if +!!$ end do +!!$ +!!$ else if (.not.present(mask)) then +!!$ +!!$ do i=1, is +!!$ if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then +!!$ ix = idxmap%glob_to_loc(idx(i)) +!!$ if (ix < 0) then +!!$ ix = idxmap%local_cols + 1 +!!$ call psb_ensure_size(ix,idxmap%loc_to_glob,info,addsz=laddsz) +!!$ if (info /= 0) then +!!$ info = -4 +!!$ return +!!$ end if +!!$ idxmap%local_cols = ix +!!$ idxmap%loc_to_glob(ix) = idx(i) +!!$ idxmap%glob_to_loc(idx(i)) = ix +!!$ end if +!!$ idx(i) = ix +!!$ else +!!$ idx(i) = -1 +!!$ end if +!!$ end do +!!$ end if +!!$ end if +!!$ +!!$ else +!!$ idx = -1 +!!$ info = -1 +!!$ end if +!!$ +!!$ end subroutine list_g2lv1_ins +!!$ +!!$ subroutine list_g2lv2_ins(idxin,idxout,idxmap,info,mask,lidx) +!!$ implicit none +!!$ class(psb_list_map), intent(inout) :: idxmap +!!$ integer(psb_ipk_), intent(in) :: idxin(:) +!!$ integer(psb_ipk_), intent(out) :: idxout(:) +!!$ integer(psb_ipk_), intent(out) :: info +!!$ logical, intent(in), optional :: mask(:) +!!$ integer(psb_ipk_), intent(in), optional :: lidx(:) +!!$ +!!$ integer(psb_ipk_) :: is, im +!!$ +!!$ is = size(idxin) +!!$ im = min(is,size(idxout)) +!!$ idxout(1:im) = idxin(1:im) +!!$ call idxmap%g2lip_ins(idxout(1:im),info,mask=mask,lidx=lidx) +!!$ if (is > im) info = -3 +!!$ +!!$ end subroutine list_g2lv2_ins +!!$ + - subroutine list_g2ls1_ins(idx,idxmap,info,mask,lidx) + subroutine list_lg2ls1_ins(idx,idxmap,info,mask,lidx) use psb_realloc_mod use psb_sort_mod implicit none class(psb_list_map), intent(inout) :: idxmap - integer(psb_ipk_), intent(inout) :: idx + integer(psb_lpk_), intent(inout) :: idx integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask integer(psb_ipk_), intent(in), optional :: lidx - integer(psb_ipk_) :: idxv(1), lidxv(1) + integer(psb_lpk_) :: idxv(1) + integer(psb_ipk_) :: lidxv(1) info = 0 if (present(mask)) then @@ -637,193 +838,17 @@ contains idx = idxv(1) - end subroutine list_g2ls1_ins + end subroutine list_lg2ls1_ins - subroutine list_g2ls2_ins(idxin,idxout,idxmap,info,mask,lidx) + subroutine list_lg2ls2_ins(idxin,idxout,idxmap,info,mask,lidx) implicit none class(psb_list_map), intent(inout) :: idxmap - integer(psb_ipk_), intent(in) :: idxin + integer(psb_lpk_), intent(in) :: idxin integer(psb_ipk_), intent(out) :: idxout integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask integer(psb_ipk_), intent(in), optional :: lidx - idxout = idxin - call idxmap%g2lip_ins(idxout,info,mask=mask,lidx=lidx) - - end subroutine list_g2ls2_ins - - - subroutine list_g2lv1_ins(idx,idxmap,info,mask,lidx) - use psb_realloc_mod - use psb_sort_mod - implicit none - class(psb_list_map), intent(inout) :: idxmap - integer(psb_ipk_), intent(inout) :: idx(:) - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask(:) - integer(psb_ipk_), intent(in), optional :: lidx(:) - - integer(psb_ipk_) :: i, is, ix, lix - - info = 0 - is = size(idx) - - if (present(mask)) then - if (size(mask) < size(idx)) then - info = -1 - return - end if - end if - if (present(lidx)) then - if (size(lidx) < size(idx)) then - info = -1 - return - end if - end if - - - if (idxmap%is_asb()) then - ! State is wrong for this one ! - idx = -1 - info = -1 - - else if (idxmap%is_valid()) then - - if (present(lidx)) then - if (present(mask)) then - do i=1, is - if (mask(i)) then - if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then - ix = idxmap%glob_to_loc(idx(i)) - if (ix < 0) then - ix = lidx(i) - call psb_ensure_size(ix,idxmap%loc_to_glob,info,addsz=laddsz) - if ((ix <= idxmap%local_rows).or.(info /= 0)) then - info = -4 - return - end if - idxmap%local_cols = max(ix,idxmap%local_cols) - idxmap%loc_to_glob(ix) = idx(i) - idxmap%glob_to_loc(idx(i)) = ix - end if - idx(i) = ix - else - idx(i) = -1 - end if - end if - end do - - else if (.not.present(mask)) then - - do i=1, is - if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then - ix = idxmap%glob_to_loc(idx(i)) - if (ix < 0) then - ix = lidx(i) - call psb_ensure_size(ix,idxmap%loc_to_glob,info,addsz=laddsz) - if ((ix <= idxmap%local_rows).or.(info /= 0)) then - info = -4 - return - end if - idxmap%local_cols = max(ix,idxmap%local_cols) - idxmap%loc_to_glob(ix) = idx(i) - idxmap%glob_to_loc(idx(i)) = ix - end if - idx(i) = ix - else - idx(i) = -1 - end if - end do - end if - - else if (.not.present(lidx)) then - - if (present(mask)) then - do i=1, is - if (mask(i)) then - if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then - ix = idxmap%glob_to_loc(idx(i)) - if (ix < 0) then - ix = idxmap%local_cols + 1 - call psb_ensure_size(ix,idxmap%loc_to_glob,info,addsz=laddsz) - if (info /= 0) then - info = -4 - return - end if - idxmap%local_cols = ix - idxmap%loc_to_glob(ix) = idx(i) - idxmap%glob_to_loc(idx(i)) = ix - end if - idx(i) = ix - else - idx(i) = -1 - end if - end if - end do - - else if (.not.present(mask)) then - - do i=1, is - if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then - ix = idxmap%glob_to_loc(idx(i)) - if (ix < 0) then - ix = idxmap%local_cols + 1 - call psb_ensure_size(ix,idxmap%loc_to_glob,info,addsz=laddsz) - if (info /= 0) then - info = -4 - return - end if - idxmap%local_cols = ix - idxmap%loc_to_glob(ix) = idx(i) - idxmap%glob_to_loc(idx(i)) = ix - end if - idx(i) = ix - else - idx(i) = -1 - end if - end do - end if - end if - - else - idx = -1 - info = -1 - end if - - end subroutine list_g2lv1_ins - - subroutine list_g2lv2_ins(idxin,idxout,idxmap,info,mask,lidx) - implicit none - class(psb_list_map), intent(inout) :: idxmap - integer(psb_ipk_), intent(in) :: idxin(:) - integer(psb_ipk_), intent(out) :: idxout(:) - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask(:) - integer(psb_ipk_), intent(in), optional :: lidx(:) - - integer(psb_ipk_) :: is, im - - is = size(idxin) - im = min(is,size(idxout)) - idxout(1:im) = idxin(1:im) - call idxmap%g2lip_ins(idxout(1:im),info,mask=mask,lidx=lidx) - if (is > im) info = -3 - - end subroutine list_g2lv2_ins - - - - subroutine list_lg2ls1_ins(idx,idxmap,info,mask,lidx) - use psb_realloc_mod - use psb_sort_mod - implicit none - class(psb_list_map), intent(inout) :: idxmap - integer(psb_lpk_), intent(inout) :: idx - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask - integer(psb_ipk_), intent(in), optional :: lidx - integer(psb_lpk_) :: idxv(1) integer(psb_ipk_) :: lidxv(1) @@ -831,7 +856,7 @@ contains if (present(mask)) then if (.not.mask) return end if - idxv(1) = idx + idxv(1) = idxin if (present(lidx)) then lidxv(1) = lidx call idxmap%g2lip_ins(idxv,info,lidx=lidxv) @@ -839,21 +864,7 @@ contains call idxmap%g2lip_ins(idxv,info) end if - idx = idxv(1) - - end subroutine list_lg2ls1_ins - - subroutine list_lg2ls2_ins(idxin,idxout,idxmap,info,mask,lidx) - implicit none - class(psb_list_map), intent(inout) :: idxmap - integer(psb_lpk_), intent(in) :: idxin - integer(psb_ipk_), intent(out) :: idxout - integer(psb_ipk_), intent(out) :: info - logical, intent(in), optional :: mask - integer(psb_ipk_), intent(in), optional :: lidx - - idxout = idxin - call idxmap%g2lip_ins(idxout,info,mask=mask,lidx=lidx) + idxout = idxv(1) end subroutine list_lg2ls2_ins @@ -1057,7 +1068,7 @@ contains end if lvl(1:nl) = vl(1:nl) - call idxmap%init_lvl(ictxt,lvl,info) + call idxmap%init_vl(ictxt,lvl,info) end subroutine list_initvl diff --git a/base/modules/desc/psb_repl_map_mod.f90 b/base/modules/desc/psb_repl_map_mod.f90 index 9c6e19ae..80887823 100644 --- a/base/modules/desc/psb_repl_map_mod.f90 +++ b/base/modules/desc/psb_repl_map_mod.f90 @@ -58,20 +58,20 @@ module psb_repl_map_mod procedure, pass(idxmap) :: reinit => repl_reinit procedure, nopass :: get_fmt => repl_get_fmt - procedure, pass(idxmap) :: l2gs1 => repl_l2gs1 - procedure, pass(idxmap) :: l2gs2 => repl_l2gs2 - procedure, pass(idxmap) :: l2gv1 => repl_l2gv1 - procedure, pass(idxmap) :: l2gv2 => repl_l2gv2 + procedure, pass(idxmap) :: ll2gs1 => repl_l2gs1 + procedure, pass(idxmap) :: ll2gs2 => repl_l2gs2 + procedure, pass(idxmap) :: ll2gv1 => repl_l2gv1 + procedure, pass(idxmap) :: ll2gv2 => repl_l2gv2 - procedure, pass(idxmap) :: g2ls1 => repl_g2ls1 - procedure, pass(idxmap) :: g2ls2 => repl_g2ls2 - procedure, pass(idxmap) :: g2lv1 => repl_g2lv1 - procedure, pass(idxmap) :: g2lv2 => repl_g2lv2 + procedure, pass(idxmap) :: lg2ls1 => repl_g2ls1 + procedure, pass(idxmap) :: lg2ls2 => repl_g2ls2 + procedure, pass(idxmap) :: lg2lv1 => repl_g2lv1 + procedure, pass(idxmap) :: lg2lv2 => repl_g2lv2 - procedure, pass(idxmap) :: g2ls1_ins => repl_g2ls1_ins - procedure, pass(idxmap) :: g2ls2_ins => repl_g2ls2_ins - procedure, pass(idxmap) :: g2lv1_ins => repl_g2lv1_ins - procedure, pass(idxmap) :: g2lv2_ins => repl_g2lv2_ins + procedure, pass(idxmap) :: lg2ls1_ins => repl_g2ls1_ins + procedure, pass(idxmap) :: lg2ls2_ins => repl_g2ls2_ins + procedure, pass(idxmap) :: lg2lv1_ins => repl_g2lv1_ins + procedure, pass(idxmap) :: lg2lv2_ins => repl_g2lv2_ins procedure, pass(idxmap) :: fnd_owner => repl_fnd_owner @@ -107,11 +107,11 @@ contains subroutine repl_l2gs1(idx,idxmap,info,mask,owned) implicit none class(psb_repl_map), intent(in) :: idxmap - integer(psb_ipk_), intent(inout) :: idx + integer(psb_lpk_), intent(inout) :: idx integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask logical, intent(in), optional :: owned - integer(psb_ipk_) :: idxv(1) + integer(psb_lpk_) :: idxv(1) info = 0 if (present(mask)) then if (.not.mask) return @@ -127,13 +127,20 @@ contains implicit none class(psb_repl_map), intent(in) :: idxmap integer(psb_ipk_), intent(in) :: idxin - integer(psb_ipk_), intent(out) :: idxout + integer(psb_lpk_), intent(out) :: idxout integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask logical, intent(in), optional :: owned - idxout = idxin - call idxmap%l2gip(idxout,info,mask,owned) + integer(psb_lpk_) :: idxv(1) + info = 0 + if (present(mask)) then + if (.not.mask) return + end if + + idxv(1) = idxin + call idxmap%l2gip(idxv,info,owned=owned) + idxout = idxv(1) end subroutine repl_l2gs2 @@ -141,11 +148,11 @@ contains subroutine repl_l2gv1(idx,idxmap,info,mask,owned) implicit none class(psb_repl_map), intent(in) :: idxmap - integer(psb_ipk_), intent(inout) :: idx(:) + integer(psb_lpk_), intent(inout) :: idx(:) integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask(:) logical, intent(in), optional :: owned - integer(psb_ipk_) :: i + integer(psb_lpk_) :: i logical :: owned_ info = 0 @@ -191,12 +198,12 @@ contains implicit none class(psb_repl_map), intent(in) :: idxmap integer(psb_ipk_), intent(in) :: idxin(:) - integer(psb_ipk_), intent(out) :: idxout(:) + integer(psb_lpk_), intent(out) :: idxout(:) integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask(:) logical, intent(in), optional :: owned - integer(psb_ipk_) :: is, im - integer(psb_ipk_) :: i + integer(psb_lpk_) :: is, im + integer(psb_lpk_) :: i logical :: owned_ info = 0 @@ -247,11 +254,11 @@ contains subroutine repl_g2ls1(idx,idxmap,info,mask,owned) implicit none class(psb_repl_map), intent(in) :: idxmap - integer(psb_ipk_), intent(inout) :: idx + integer(psb_lpk_), intent(inout) :: idx integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask logical, intent(in), optional :: owned - integer(psb_ipk_) :: idxv(1) + integer(psb_lpk_) :: idxv(1) info = 0 if (present(mask)) then @@ -267,26 +274,35 @@ contains subroutine repl_g2ls2(idxin,idxout,idxmap,info,mask,owned) implicit none class(psb_repl_map), intent(in) :: idxmap - integer(psb_ipk_), intent(in) :: idxin + integer(psb_lpk_), intent(in) :: idxin integer(psb_ipk_), intent(out) :: idxout integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask logical, intent(in), optional :: owned - idxout = idxin - call idxmap%g2lip(idxout,info,mask,owned) + integer(psb_lpk_) :: idxv(1) + info = 0 + + if (present(mask)) then + if (.not.mask) return + end if + + idxv(1) = idxin + call idxmap%g2lip(idxv,info,owned=owned) + idxout = idxv(1) - end subroutine repl_g2ls2 + end subroutine repl_g2ls2 + subroutine repl_g2lv1(idx,idxmap,info,mask,owned) implicit none class(psb_repl_map), intent(in) :: idxmap - integer(psb_ipk_), intent(inout) :: idx(:) + integer(psb_lpk_), intent(inout) :: idx(:) integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask(:) logical, intent(in), optional :: owned - integer(psb_ipk_) :: i, is + integer(psb_lpk_) :: i, is logical :: owned_ info = 0 @@ -363,13 +379,13 @@ contains subroutine repl_g2lv2(idxin,idxout,idxmap,info,mask,owned) implicit none class(psb_repl_map), intent(in) :: idxmap - integer(psb_ipk_), intent(in) :: idxin(:) + integer(psb_lpk_), intent(in) :: idxin(:) integer(psb_ipk_), intent(out) :: idxout(:) integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask(:) logical, intent(in), optional :: owned - integer(psb_ipk_) :: is, im,i + integer(psb_lpk_) :: is, im,i logical :: owned_ info = 0 @@ -453,12 +469,13 @@ contains use psb_sort_mod implicit none class(psb_repl_map), intent(inout) :: idxmap - integer(psb_ipk_), intent(inout) :: idx + integer(psb_lpk_), intent(inout) :: idx integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask integer(psb_ipk_), intent(in), optional :: lidx - integer(psb_ipk_) :: idxv(1),lidxv(1) + integer(psb_lpk_) :: idxv(1) + integer(psb_ipk_) :: lidxv(1) info = 0 if (present(mask)) then @@ -478,14 +495,27 @@ contains subroutine repl_g2ls2_ins(idxin,idxout,idxmap,info,mask,lidx) implicit none class(psb_repl_map), intent(inout) :: idxmap - integer(psb_ipk_), intent(in) :: idxin + integer(psb_lpk_), intent(in) :: idxin integer(psb_ipk_), intent(out) :: idxout integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask integer(psb_ipk_), intent(in), optional :: lidx - - idxout = idxin - call idxmap%g2lip_ins(idxout,info,mask=mask,lidx=lidx) + integer(psb_lpk_) :: idxv(1) + integer(psb_ipk_) :: lidxv(1) + + info = 0 + if (present(mask)) then + if (.not.mask) return + end if + idxv(1) = idxin + if (present(lidx)) then + lidxv(1) = lidx + call idxmap%g2lip_ins(idxv,info,lidx=lidxv) + else + call idxmap%g2lip_ins(idxv,info) + end if + idxout = idxv(1) + end subroutine repl_g2ls2_ins @@ -495,12 +525,12 @@ contains use psb_sort_mod implicit none class(psb_repl_map), intent(inout) :: idxmap - integer(psb_ipk_), intent(inout) :: idx(:) + integer(psb_lpk_), intent(inout) :: idx(:) integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask(:) integer(psb_ipk_), intent(in), optional :: lidx(:) - integer(psb_ipk_) :: i, is + integer(psb_lpk_) :: i, is info = 0 is = size(idx) @@ -579,13 +609,13 @@ contains subroutine repl_g2lv2_ins(idxin,idxout,idxmap,info,mask,lidx) implicit none class(psb_repl_map), intent(inout) :: idxmap - integer(psb_ipk_), intent(in) :: idxin(:) + integer(psb_lpk_), intent(in) :: idxin(:) integer(psb_ipk_), intent(out) :: idxout(:) integer(psb_ipk_), intent(out) :: info logical, intent(in), optional :: mask(:) integer(psb_ipk_), intent(in), optional :: lidx(:) - integer(psb_ipk_) :: is, im, i + integer(psb_lpk_) :: is, im, i info = 0 @@ -669,7 +699,7 @@ contains subroutine repl_fnd_owner(idx,iprc,idxmap,info) use psb_penv_mod implicit none - integer(psb_ipk_), intent(in) :: idx(:) + integer(psb_lpk_), intent(in) :: idx(:) integer(psb_ipk_), allocatable, intent(out) :: iprc(:) class(psb_repl_map), intent(in) :: idxmap integer(psb_ipk_), intent(out) :: info @@ -695,7 +725,7 @@ contains use psb_error_mod implicit none class(psb_repl_map), intent(inout) :: idxmap - integer(psb_ipk_), intent(in) :: nl + integer(psb_lpk_), intent(in) :: nl integer(psb_mpk_), intent(in) :: ictxt integer(psb_ipk_), intent(out) :: info ! To be implemented