psblas3:
base/comm/psb_cgather.f90 base/comm/psb_cscatter.F90 base/comm/psb_dgather.f90 base/comm/psb_dscatter.F90 base/comm/psb_igather.f90 base/comm/psb_iscatter.F90 base/comm/psb_sgather.f90 base/comm/psb_sscatter.F90 base/comm/psb_zgather.f90 base/comm/psb_zscatter.F90 base/internals/Makefile base/internals/psb_indx_map_fnd_owner.F90 base/internals/psi_bld_g2lmap.f90 base/internals/psi_bld_tmphalo.f90 base/internals/psi_crea_index.f90 base/internals/psi_desc_index.F90 base/internals/psi_extrct_dl.F90 base/internals/psi_fnd_owner.F90 base/internals/psi_idx_cnv.f90 base/internals/psi_idx_ins_cnv.f90 base/internals/psi_ldsc_pre_halo.f90 base/modules/Makefile base/modules/psb_base_tools_mod.f90 base/modules/psb_desc_const_mod.f90 base/modules/psb_desc_type.f90 base/modules/psb_gen_block_map_mod.f03 base/modules/psb_glist_map_mod.f03 base/modules/psb_hash_map_mod.f03 base/modules/psb_indx_map_mod.f03 base/modules/psb_list_map_mod.f03 base/modules/psb_repl_map_mod.f03 base/modules/psb_sort_mod.f90 base/modules/psi_mod.f90 base/modules/psi_reduce_mod.F90 base/serial/f03/psb_c_coo_impl.f03 base/serial/f03/psb_d_coo_impl.f03 base/serial/f03/psb_s_coo_impl.f03 base/serial/f03/psb_z_coo_impl.f03 base/serial/psb_sort_impl.f90 base/tools/Makefile base/tools/psb_ccdbldext.F90 base/tools/psb_cd_inloc.f90 base/tools/psb_cd_set_bld.f90 base/tools/psb_cd_switch_ovl_indxmap.f90 base/tools/psb_cdall.f90 base/tools/psb_cdals.f90 base/tools/psb_cdalv.f90 base/tools/psb_cdcpy.f90 base/tools/psb_cdins.f90 base/tools/psb_cdprt.f90 base/tools/psb_cdren.f90 base/tools/psb_cdrep.f90 base/tools/psb_cspins.f90 base/tools/psb_dcdbldext.F90 base/tools/psb_dspins.f90 base/tools/psb_icdasb.F90 base/tools/psb_loc_to_glob.f90 base/tools/psb_scdbldext.F90 base/tools/psb_sspins.f90 base/tools/psb_zcdbldext.F90 base/tools/psb_zspins.f90 test/fileread/cf_sample.f90 test/fileread/df_sample.f90 test/fileread/runs/dfs.inp test/fileread/sf_sample.f90 test/fileread/zf_sample.f90 test/pargen/ppde.f90 test/pargen/runs/ppde.inp test/pargen/spde.f90 util/psb_mat_dist_impl.f90 Merge work on INDXMAP.psblas3-type-indexed
parent
193d9eabf5
commit
5e4b52eb4e
@ -0,0 +1,298 @@
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.0
|
||||
!!$ (C) Copyright 2006, 2007, 2008, 2009, 2010
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
!!$
|
||||
!!$ Redistribution and use in source and binary forms, with or without
|
||||
!!$ modification, are permitted provided that the following conditions
|
||||
!!$ are met:
|
||||
!!$ 1. Redistributions of source code must retain the above copyright
|
||||
!!$ notice, this list of conditions and the following disclaimer.
|
||||
!!$ 2. Redistributions in binary form must reproduce the above copyright
|
||||
!!$ notice, this list of conditions, and the following disclaimer in the
|
||||
!!$ documentation and/or other materials provided with the distribution.
|
||||
!!$ 3. The name of the PSBLAS group or the names of its contributors may
|
||||
!!$ not be used to endorse or promote products derived from this
|
||||
!!$ software without specific written permission.
|
||||
!!$
|
||||
!!$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
!!$ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
!!$ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
!!$ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
!!$ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
!!$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
!!$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
!!$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
!!$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
!!$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
!!$ POSSIBILITY OF SUCH DAMAGE.
|
||||
!!$
|
||||
!!$
|
||||
!
|
||||
! File: psi_fnd_owner.f90
|
||||
!
|
||||
! Subroutine: psi_fnd_owner
|
||||
! Figure out who owns global indices.
|
||||
!
|
||||
! Arguments:
|
||||
! nv - integer Number of indices required on the calling
|
||||
! process
|
||||
! idx(:) - integer Required indices on the calling process.
|
||||
! Note: the indices should be unique!
|
||||
! iprc(:) - integer, allocatable Output: process identifiers for the corresponding
|
||||
! indices
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code.
|
||||
!
|
||||
subroutine psb_indx_map_fnd_owner(idx,iprc,idxmap,info)
|
||||
use psb_serial_mod
|
||||
use psb_const_mod
|
||||
use psb_error_mod
|
||||
use psb_penv_mod
|
||||
use psb_realloc_mod
|
||||
use psb_indx_map_mod, psb_protect_name => psb_indx_map_fnd_owner
|
||||
#ifdef MPI_MOD
|
||||
use mpi
|
||||
#endif
|
||||
|
||||
implicit none
|
||||
#ifdef MPI_H
|
||||
include 'mpif.h'
|
||||
#endif
|
||||
integer, intent(in) :: idx(:)
|
||||
integer, allocatable, intent(out) :: iprc(:)
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer, intent(out) :: info
|
||||
|
||||
|
||||
integer, allocatable :: hsz(:),hidx(:),helem(:),hproc(:),&
|
||||
& sdsz(:),sdidx(:), rvsz(:), rvidx(:),answers(:,:),idxsrch(:,:)
|
||||
|
||||
integer :: i,n_row,n_col,err_act,ih,icomm,hsize,ip,isz,k,j,&
|
||||
& last_ih, last_j, nv
|
||||
integer :: ictxt,np,me
|
||||
logical, parameter :: gettime=.false.
|
||||
real(psb_dpk_) :: t0, t1, t2, t3, t4, tamx, tidx
|
||||
character(len=20) :: name
|
||||
|
||||
info = psb_success_
|
||||
name = 'psb_indx_map_fnd_owner'
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
ictxt = idxmap%get_ctxt()
|
||||
icomm = idxmap%get_mpic()
|
||||
n_row = idxmap%get_lr()
|
||||
n_col = idxmap%get_lc()
|
||||
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (.not.(idxmap%is_valid())) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='invalid idxmap')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (gettime) then
|
||||
t0 = psb_wtime()
|
||||
end if
|
||||
|
||||
nv = size(idx)
|
||||
!
|
||||
! The basic idea is very simple.
|
||||
! First we collect (to all) all the requests.
|
||||
Allocate(hidx(np+1),hsz(np),&
|
||||
& sdsz(0:np-1),sdidx(0:np-1),&
|
||||
& rvsz(0:np-1),rvidx(0:np-1),&
|
||||
& stat=info)
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='Allocate')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
hsz = 0
|
||||
hsz(me+1) = nv
|
||||
call psb_amx(ictxt,hsz)
|
||||
hidx(1) = 0
|
||||
do i=1, np
|
||||
hidx(i+1) = hidx(i) + hsz(i)
|
||||
end do
|
||||
hsize = hidx(np+1)
|
||||
Allocate(helem(hsize),hproc(hsize),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='Allocate')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (gettime) then
|
||||
t3 = psb_wtime()
|
||||
end if
|
||||
|
||||
call mpi_allgatherv(idx,hsz(me+1),mpi_integer,&
|
||||
& hproc,hsz,hidx,mpi_integer,&
|
||||
& icomm,info)
|
||||
if (gettime) then
|
||||
tamx = psb_wtime() - t3
|
||||
end if
|
||||
|
||||
! Second, we figure out locally whether we own the indices (whoever is
|
||||
! asking for them).
|
||||
if (gettime) then
|
||||
t3 = psb_wtime()
|
||||
end if
|
||||
|
||||
call idxmap%g2l(hproc(1:hsize),helem(1:hsize),info,owned=.true.)
|
||||
if (gettime) then
|
||||
tidx = psb_wtime()-t3
|
||||
end if
|
||||
if (info == psb_err_iarray_outside_bounds_) info = psb_success_
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='psi_idx_cnv')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
! Third: we build the answers for those indices we own,
|
||||
! with a section for each process asking.
|
||||
hidx = hidx +1
|
||||
j = 0
|
||||
do ip = 0, np-1
|
||||
sdidx(ip) = j
|
||||
sdsz(ip) = 0
|
||||
do i=hidx(ip+1), hidx(ip+1+1)-1
|
||||
if ((0 < helem(i)).and. (helem(i) <= n_row)) then
|
||||
j = j + 1
|
||||
hproc(j) = hproc(i)
|
||||
sdsz(ip) = sdsz(ip) + 1
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
|
||||
if (gettime) then
|
||||
t3 = psb_wtime()
|
||||
end if
|
||||
|
||||
! Collect all the answers with alltoallv (need sizes)
|
||||
call mpi_alltoall(sdsz,1,mpi_integer,rvsz,1,mpi_integer,icomm,info)
|
||||
|
||||
isz = sum(rvsz)
|
||||
|
||||
allocate(answers(isz,2),idxsrch(nv,2),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='Allocate')
|
||||
goto 9999
|
||||
end if
|
||||
j = 0
|
||||
do ip=0, np-1
|
||||
rvidx(ip) = j
|
||||
j = j + rvsz(ip)
|
||||
end do
|
||||
call mpi_alltoallv(hproc,sdsz,sdidx,mpi_integer,&
|
||||
& answers(:,1),rvsz,rvidx,mpi_integer,&
|
||||
& icomm,info)
|
||||
if (gettime) then
|
||||
tamx = psb_wtime() - t3 + tamx
|
||||
end if
|
||||
j = 1
|
||||
do ip = 0,np-1
|
||||
do k=1,rvsz(ip)
|
||||
answers(j,2) = ip
|
||||
j = j + 1
|
||||
end do
|
||||
end do
|
||||
! Sort the answers and the requests, so we can
|
||||
! match them efficiently
|
||||
call psb_msort(answers(:,1),ix=answers(:,2),&
|
||||
& flag=psb_sort_keep_idx_)
|
||||
idxsrch(1:nv,1) = idx(1:nv)
|
||||
call psb_msort(idxsrch(1:nv,1),ix=idxsrch(1:nv,2))
|
||||
|
||||
! Now extract the answers for our local query
|
||||
call psb_realloc(nv,iprc,info)
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_realloc')
|
||||
goto 9999
|
||||
end if
|
||||
last_ih = -1
|
||||
last_j = -1
|
||||
j = 1
|
||||
do i=1, nv
|
||||
ih = idxsrch(i,1)
|
||||
if (ih == last_ih) then
|
||||
iprc(idxsrch(i,2)) = answers(last_j,2)
|
||||
else
|
||||
|
||||
do
|
||||
if (j > size(answers,1)) then
|
||||
! Last resort attempt.
|
||||
j = psb_ibsrch(ih,size(answers,1),answers(:,1))
|
||||
if (j == -1) then
|
||||
write(psb_err_unit,*) me,'psi_fnd_owner: searching for ',ih, &
|
||||
& 'not found : ',size(answers,1),':',answers(:,1)
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(psb_err_internal_error_,name,a_err='out bounds srch ih')
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
if (answers(j,1) == ih) exit
|
||||
if (answers(j,1) > ih) then
|
||||
k = j
|
||||
j = psb_ibsrch(ih,k,answers(1:k,1))
|
||||
if (j == -1) then
|
||||
write(psb_err_unit,*) me,'psi_fnd_owner: searching for ',ih, &
|
||||
& 'not found : ',size(answers,1),':',answers(:,1)
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(psb_err_internal_error_,name,a_err='out bounds srch ih')
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
|
||||
j = j + 1
|
||||
end do
|
||||
! Note that the answers here are given in order
|
||||
! of sending process, so we are implicitly getting
|
||||
! the max process index in case of overlap.
|
||||
last_ih = ih
|
||||
do
|
||||
last_j = j
|
||||
iprc(idxsrch(i,2)) = answers(j,2)
|
||||
j = j + 1
|
||||
if (j > size(answers,1)) exit
|
||||
if (answers(j,1) /= ih) exit
|
||||
end do
|
||||
end if
|
||||
end do
|
||||
|
||||
if (gettime) then
|
||||
call psb_barrier(ictxt)
|
||||
t1 = psb_wtime()
|
||||
t1 = t1 -t0 - tamx - tidx
|
||||
call psb_amx(ictxt,tamx)
|
||||
call psb_amx(ictxt,tidx)
|
||||
call psb_amx(ictxt,t1)
|
||||
if (me == psb_root_) then
|
||||
write(psb_out_unit,'(" fnd_owner idx time : ",es10.4)') tidx
|
||||
write(psb_out_unit,'(" fnd_owner amx time : ",es10.4)') tamx
|
||||
write(psb_out_unit,'(" fnd_owner remainedr : ",es10.4)') t1
|
||||
endif
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
|
||||
if (err_act == psb_act_ret_) then
|
||||
return
|
||||
else
|
||||
call psb_error(ictxt)
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine psb_indx_map_fnd_owner
|
@ -1,165 +0,0 @@
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.0
|
||||
!!$ (C) Copyright 2006, 2007, 2008, 2009, 2010
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
!!$
|
||||
!!$ Redistribution and use in source and binary forms, with or without
|
||||
!!$ modification, are permitted provided that the following conditions
|
||||
!!$ are met:
|
||||
!!$ 1. Redistributions of source code must retain the above copyright
|
||||
!!$ notice, this list of conditions and the following disclaimer.
|
||||
!!$ 2. Redistributions in binary form must reproduce the above copyright
|
||||
!!$ notice, this list of conditions, and the following disclaimer in the
|
||||
!!$ documentation and/or other materials provided with the distribution.
|
||||
!!$ 3. The name of the PSBLAS group or the names of its contributors may
|
||||
!!$ not be used to endorse or promote products derived from this
|
||||
!!$ software without specific written permission.
|
||||
!!$
|
||||
!!$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
!!$ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
!!$ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
!!$ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
!!$ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
!!$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
!!$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
!!$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
!!$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
!!$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
!!$ POSSIBILITY OF SUCH DAMAGE.
|
||||
!!$
|
||||
!!$
|
||||
!
|
||||
! File: psi_bld_hash.f90
|
||||
!
|
||||
! Subroutine: psi_bld_hash
|
||||
! Build a hashed list of ordered sublists of the indices
|
||||
! contained in loc_to_glob.
|
||||
!
|
||||
!
|
||||
! Arguments:
|
||||
! desc - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code.
|
||||
!
|
||||
subroutine psi_bld_g2lmap(desc,info)
|
||||
use psb_descriptor_type
|
||||
use psb_serial_mod
|
||||
use psb_const_mod
|
||||
use psb_error_mod
|
||||
use psb_penv_mod
|
||||
use psb_realloc_mod
|
||||
use psi_mod, psb_protect_name => psi_bld_g2lmap
|
||||
implicit none
|
||||
type(psb_desc_type), intent(inout) :: desc
|
||||
integer, intent(out) :: info
|
||||
|
||||
integer :: i,j,np,me,lhalo,nhalo,nbits,hsize,hmask,&
|
||||
& n_col, err_act, key, ih, nh, idx, nk,icomm
|
||||
integer :: ictxt,n_row
|
||||
character(len=20) :: name,ch_err
|
||||
|
||||
info = psb_success_
|
||||
name = 'psi_bld_g2lmap'
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
ictxt = psb_cd_get_context(desc)
|
||||
icomm = psb_cd_get_mpic(desc)
|
||||
n_row = psb_cd_get_local_rows(desc)
|
||||
n_col = psb_cd_get_local_cols(desc)
|
||||
|
||||
! check on blacs grid
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
|
||||
if (.not.(psb_is_bld_desc(desc).and.psb_is_large_desc(desc))) then
|
||||
info = psb_err_invalid_cd_state_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
nk = n_col
|
||||
call psb_realloc(nk,2,desc%idxmap%glb_lc,info)
|
||||
|
||||
nbits = psb_hash_bits
|
||||
hsize = 2**nbits
|
||||
do
|
||||
if (hsize < 0) then
|
||||
! This should never happen for sane values
|
||||
! of psb_max_hash_bits.
|
||||
write(psb_err_unit,*) 'Error: hash size overflow ',hsize,nbits
|
||||
info = -2
|
||||
return
|
||||
end if
|
||||
if (hsize > nk) exit
|
||||
if (nbits >= psb_max_hash_bits) exit
|
||||
nbits = nbits + 1
|
||||
hsize = hsize * 2
|
||||
end do
|
||||
hmask = hsize - 1
|
||||
desc%idxmap%hashvsize = hsize
|
||||
desc%idxmap%hashvmask = hmask
|
||||
if (info == psb_success_) call psb_realloc(hsize+1,desc%idxmap%hashv,info,lb=0)
|
||||
if (info /= psb_success_) then
|
||||
ch_err='psb_realloc'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
! Build a hashed table of sorted lists to search for
|
||||
! indices.
|
||||
desc%idxmap%hashv(0:hsize) = 0
|
||||
do i=1, nk
|
||||
key = desc%idxmap%loc_to_glob(i)
|
||||
ih = iand(key,hmask)
|
||||
desc%idxmap%hashv(ih) = desc%idxmap%hashv(ih) + 1
|
||||
end do
|
||||
nh = desc%idxmap%hashv(0)
|
||||
idx = 1
|
||||
do i=1, hsize
|
||||
desc%idxmap%hashv(i-1) = idx
|
||||
idx = idx + nh
|
||||
nh = desc%idxmap%hashv(i)
|
||||
end do
|
||||
do i=1, nk
|
||||
key = desc%idxmap%loc_to_glob(i)
|
||||
ih = iand(key,hmask)
|
||||
idx = desc%idxmap%hashv(ih)
|
||||
desc%idxmap%glb_lc(idx,1) = key
|
||||
desc%idxmap%glb_lc(idx,2) = i
|
||||
desc%idxmap%hashv(ih) = desc%idxmap%hashv(ih) + 1
|
||||
end do
|
||||
do i = hsize, 1, -1
|
||||
desc%idxmap%hashv(i) = desc%idxmap%hashv(i-1)
|
||||
end do
|
||||
desc%idxmap%hashv(0) = 1
|
||||
do i=0, hsize-1
|
||||
idx = desc%idxmap%hashv(i)
|
||||
nh = desc%idxmap%hashv(i+1) - desc%idxmap%hashv(i)
|
||||
if (nh > 1) then
|
||||
call psb_msort(desc%idxmap%glb_lc(idx:idx+nh-1,1),&
|
||||
& ix=desc%idxmap%glb_lc(idx:idx+nh-1,2),&
|
||||
& flag=psb_sort_keep_idx_)
|
||||
end if
|
||||
end do
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
|
||||
if (err_act == psb_act_ret_) then
|
||||
return
|
||||
else
|
||||
call psb_error(ictxt)
|
||||
end if
|
||||
return
|
||||
|
||||
|
||||
end subroutine psi_bld_g2lmap
|
@ -0,0 +1,85 @@
|
||||
module psb_desc_const_mod
|
||||
!
|
||||
! Communication, prolongation & restriction
|
||||
!
|
||||
integer, parameter :: psb_nohalo_=0, psb_halo_=1
|
||||
! For overlap update.
|
||||
integer, parameter :: psb_none_=0, psb_sum_=1
|
||||
integer, parameter :: psb_avg_=2, psb_square_root_=3
|
||||
integer, parameter :: psb_setzero_=4
|
||||
|
||||
! The following are bit fields.
|
||||
integer, parameter :: psb_swap_send_=1, psb_swap_recv_=2
|
||||
integer, parameter :: psb_swap_sync_=4, psb_swap_mpi_=8
|
||||
! Choice among lists on which to base data exchange
|
||||
integer, parameter :: psb_no_comm_=-1
|
||||
integer, parameter :: psb_comm_halo_=1, psb_comm_ovr_=2
|
||||
integer, parameter :: psb_comm_ext_=3, psb_comm_mov_=4
|
||||
! Types of mapping between descriptors.
|
||||
integer, parameter :: psb_map_xhal_ = 123
|
||||
integer, parameter :: psb_map_asov_ = psb_map_xhal_+1
|
||||
integer, parameter :: psb_map_aggr_ = psb_map_asov_+1
|
||||
integer, parameter :: psb_map_gen_linear_ = psb_map_aggr_+1
|
||||
|
||||
integer, parameter :: psb_ovt_xhal_ = psb_map_xhal_, psb_ovt_asov_=psb_map_asov_
|
||||
!
|
||||
! Entries and values in desc%matrix_data
|
||||
!
|
||||
integer, parameter :: psb_dec_type_ = 1
|
||||
integer, parameter :: psb_m_ = 2
|
||||
integer, parameter :: psb_n_ = 3
|
||||
integer, parameter :: psb_n_row_ = 4
|
||||
integer, parameter :: psb_n_col_ = 5
|
||||
integer, parameter :: psb_ctxt_ = 6
|
||||
integer, parameter :: psb_desc_size_ = 7
|
||||
integer, parameter :: psb_mpi_c_ = 9
|
||||
integer, parameter :: psb_pnt_h_ = 10
|
||||
integer, parameter :: psb_thal_xch_ = 11
|
||||
integer, parameter :: psb_thal_snd_ = 12
|
||||
integer, parameter :: psb_thal_rcv_ = 13
|
||||
integer, parameter :: psb_tovr_xch_ = 14
|
||||
integer, parameter :: psb_tovr_snd_ = 15
|
||||
integer, parameter :: psb_tovr_rcv_ = 16
|
||||
integer, parameter :: psb_text_xch_ = 17
|
||||
integer, parameter :: psb_text_snd_ = 18
|
||||
integer, parameter :: psb_text_rcv_ = 19
|
||||
integer, parameter :: psb_tmov_xch_ = 20
|
||||
integer, parameter :: psb_tmov_snd_ = 21
|
||||
integer, parameter :: psb_tmov_rcv_ = 22
|
||||
integer, parameter :: psb_mdata_size_= 24
|
||||
integer, parameter :: psb_desc_invalid_=-1
|
||||
integer, parameter :: psb_desc_null_=-1
|
||||
integer, parameter :: psb_desc_asb_=3099
|
||||
integer, parameter :: psb_desc_bld_=psb_desc_asb_+1
|
||||
integer, parameter :: psb_desc_upd_=psb_desc_bld_+1
|
||||
integer, parameter :: psb_desc_repl_=3199
|
||||
integer, parameter :: psb_desc_ovl_bld_=3399
|
||||
integer, parameter :: psb_desc_ovl_asb_=psb_desc_ovl_bld_+1
|
||||
! these two are reserved for descriptors which are
|
||||
! "overlap-extensions" of base descriptors.
|
||||
integer, parameter :: psb_cd_ovl_bld_=psb_desc_ovl_bld_
|
||||
integer, parameter :: psb_cd_ovl_asb_=psb_desc_ovl_asb_
|
||||
integer, parameter :: psb_desc_normal_=3299
|
||||
integer, parameter :: psb_desc_large_=psb_desc_normal_+1
|
||||
!
|
||||
! Constants for hashing into desc%hashv(:) and desc%glb_lc(:,:)
|
||||
!
|
||||
integer, parameter :: psb_hash_bits=16
|
||||
integer, parameter :: psb_max_hash_bits=22
|
||||
integer, parameter :: psb_hash_size=2**psb_hash_bits, psb_hash_mask=psb_hash_size-1
|
||||
integer, parameter :: psb_default_large_threshold=1*1024*1024
|
||||
integer, parameter :: psb_hpnt_nentries_=7
|
||||
|
||||
!
|
||||
! Constants for desc_a handling
|
||||
!
|
||||
|
||||
integer, parameter :: psb_upd_glbnum_=998
|
||||
integer, parameter :: psb_upd_locnum_=997
|
||||
integer, parameter :: psb_proc_id_=0, psb_n_elem_recv_=1
|
||||
integer, parameter :: psb_elem_recv_=2, psb_n_elem_send_=2
|
||||
integer, parameter :: psb_elem_send_=3, psb_n_ovrlp_elem_=1
|
||||
integer, parameter :: psb_ovrlp_elem_to_=2, psb_ovrlp_elem_=0
|
||||
integer, parameter :: psb_n_dom_ovr_=1
|
||||
|
||||
end module psb_desc_const_mod
|
@ -0,0 +1,625 @@
|
||||
module psb_gen_block_map_mod
|
||||
use psb_const_mod
|
||||
use psb_desc_const_mod
|
||||
use psb_indx_map_mod
|
||||
|
||||
type, extends(psb_indx_map) :: psb_gen_block_map
|
||||
integer :: min_glob_row = -1
|
||||
integer :: max_glob_row = -1
|
||||
integer, allocatable :: loc_to_glob(:), srt_l2g(:,:), vnl(:)
|
||||
contains
|
||||
|
||||
procedure, pass(idxmap) :: gen_block_map_init => block_init
|
||||
|
||||
procedure, pass(idxmap) :: sizeof => block_sizeof
|
||||
procedure, pass(idxmap) :: asb => block_asb
|
||||
procedure, pass(idxmap) :: free => block_free
|
||||
procedure, pass(idxmap) :: 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) :: 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_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) :: fnd_owner => block_fnd_owner
|
||||
|
||||
end type psb_gen_block_map
|
||||
|
||||
private :: block_init, block_sizeof, block_asb, block_free,&
|
||||
& block_get_fmt, block_l2gs1, block_l2gs2, block_l2gv1,&
|
||||
& block_l2gv2, block_g2ls1, block_g2ls2, block_g2lv1,&
|
||||
& block_g2lv2, block_g2ls1_ins, block_g2ls2_ins,&
|
||||
& block_g2lv1_ins, block_g2lv2_ins
|
||||
|
||||
|
||||
contains
|
||||
|
||||
|
||||
function block_sizeof(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_gen_block_map), intent(in) :: idxmap
|
||||
integer(psb_long_int_k_) :: val
|
||||
|
||||
val = idxmap%psb_indx_map%sizeof()
|
||||
val = val + 2 * psb_sizeof_int
|
||||
if (allocated(idxmap%loc_to_glob)) &
|
||||
& val = val + size(idxmap%loc_to_glob)*psb_sizeof_int
|
||||
if (allocated(idxmap%srt_l2g)) &
|
||||
& val = val + size(idxmap%srt_l2g)*psb_sizeof_int
|
||||
if (allocated(idxmap%vnl)) &
|
||||
& val = val + size(idxmap%vnl)*psb_sizeof_int
|
||||
|
||||
end function block_sizeof
|
||||
|
||||
|
||||
subroutine block_free(idxmap)
|
||||
implicit none
|
||||
class(psb_gen_block_map), intent(inout) :: idxmap
|
||||
|
||||
if (allocated(idxmap%loc_to_glob)) &
|
||||
& deallocate(idxmap%loc_to_glob)
|
||||
if (allocated(idxmap%srt_l2g)) &
|
||||
& deallocate(idxmap%srt_l2g)
|
||||
|
||||
if (allocated(idxmap%srt_l2g)) &
|
||||
& deallocate(idxmap%vnl)
|
||||
|
||||
call idxmap%psb_indx_map%free()
|
||||
|
||||
end subroutine block_free
|
||||
|
||||
|
||||
subroutine block_l2gs1(idx,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_gen_block_map), intent(in) :: idxmap
|
||||
integer, intent(inout) :: idx
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
integer :: idxv(1)
|
||||
info = 0
|
||||
if (present(mask)) then
|
||||
if (.not.mask) return
|
||||
end if
|
||||
|
||||
idxv(1) = idx
|
||||
call idxmap%l2g(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, intent(in) :: idxin
|
||||
integer, intent(out) :: idxout
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
idxout = idxin
|
||||
call idxmap%l2g(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, intent(inout) :: idx(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
integer :: 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, intent(in) :: idxin(:)
|
||||
integer, intent(out) :: idxout(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
integer :: is, im
|
||||
|
||||
is = size(idxin)
|
||||
im = min(is,size(idxout))
|
||||
idxout(1:im) = idxin(1:im)
|
||||
call idxmap%l2g(idxout(1:im),info,mask,owned)
|
||||
if (is > im) then
|
||||
info = -3
|
||||
end if
|
||||
|
||||
end subroutine block_l2gv2
|
||||
|
||||
|
||||
subroutine block_g2ls1(idx,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_gen_block_map), intent(in) :: idxmap
|
||||
integer, intent(inout) :: idx
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
integer :: idxv(1)
|
||||
info = 0
|
||||
|
||||
if (present(mask)) then
|
||||
if (.not.mask) return
|
||||
end if
|
||||
|
||||
idxv(1) = idx
|
||||
call idxmap%g2l(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, intent(in) :: idxin
|
||||
integer, intent(out) :: idxout
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
idxout = idxin
|
||||
call idxmap%g2l(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, intent(inout) :: idx(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
integer :: i, nv, is
|
||||
integer :: 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)
|
||||
idx(i) = psb_ibsrch(idx(i),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
|
||||
nv = idxmap%local_cols-idxmap%local_rows
|
||||
idx(i) = psb_issrch(idx(i),nv,idxmap%loc_to_glob)
|
||||
if (idx(i) > 0) idx(i) = idx(i) + 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)
|
||||
idx(i) = psb_ibsrch(idx(i),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
|
||||
nv = idxmap%local_cols-idxmap%local_rows
|
||||
idx(i) = psb_issrch(idx(i),nv,idxmap%loc_to_glob)
|
||||
if (idx(i) > 0) idx(i) = idx(i) + 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)
|
||||
implicit none
|
||||
class(psb_gen_block_map), intent(in) :: idxmap
|
||||
integer, intent(in) :: idxin(:)
|
||||
integer, intent(out) :: idxout(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
integer :: is, im
|
||||
|
||||
is = size(idxin)
|
||||
im = min(is,size(idxout))
|
||||
idxout(1:im) = idxin(1:im)
|
||||
call idxmap%g2l(idxout(1:im),info,mask,owned)
|
||||
if (is > im) info = -3
|
||||
|
||||
end subroutine block_g2lv2
|
||||
|
||||
|
||||
|
||||
subroutine block_g2ls1_ins(idx,idxmap,info,mask)
|
||||
use psb_realloc_mod
|
||||
use psb_sort_mod
|
||||
implicit none
|
||||
class(psb_gen_block_map), intent(inout) :: idxmap
|
||||
integer, intent(inout) :: idx
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
|
||||
integer :: idxv(1)
|
||||
|
||||
info = 0
|
||||
if (present(mask)) then
|
||||
if (.not.mask) return
|
||||
end if
|
||||
idxv(1) = idx
|
||||
call idxmap%g2l_ins(idxv,info)
|
||||
idx = idxv(1)
|
||||
|
||||
end subroutine block_g2ls1_ins
|
||||
|
||||
subroutine block_g2ls2_ins(idxin,idxout,idxmap,info,mask)
|
||||
implicit none
|
||||
class(psb_gen_block_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: idxin
|
||||
integer, intent(out) :: idxout
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
|
||||
idxout = idxin
|
||||
call idxmap%g2l_ins(idxout,info)
|
||||
|
||||
end subroutine block_g2ls2_ins
|
||||
|
||||
|
||||
subroutine block_g2lv1_ins(idx,idxmap,info,mask)
|
||||
use psb_realloc_mod
|
||||
use psb_sort_mod
|
||||
implicit none
|
||||
class(psb_gen_block_map), intent(inout) :: idxmap
|
||||
integer, intent(inout) :: idx(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
integer :: i, nv, is, ix
|
||||
|
||||
info = 0
|
||||
is = size(idx)
|
||||
|
||||
if (present(mask)) then
|
||||
if (size(mask) < 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(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
|
||||
ix = psb_issrch(idx(i),nv,idxmap%loc_to_glob)
|
||||
if (ix < 0) then
|
||||
ix = idxmap%local_cols + 1
|
||||
call psb_ensure_size(ix,idxmap%loc_to_glob,info,addsz=500)
|
||||
if (info /= 0) then
|
||||
info = -4
|
||||
return
|
||||
end if
|
||||
idxmap%local_cols = ix
|
||||
ix = ix - idxmap%local_rows
|
||||
idxmap%loc_to_glob(ix) = idx(i)
|
||||
end if
|
||||
ix = ix + idxmap%local_rows
|
||||
idx(i) = ix
|
||||
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
|
||||
ix = psb_issrch(idx(i),nv,idxmap%loc_to_glob)
|
||||
if (ix < 0) then
|
||||
ix = idxmap%local_cols + 1
|
||||
call psb_ensure_size(ix,idxmap%loc_to_glob,info,addsz=500)
|
||||
if (info /= 0) then
|
||||
info = -4
|
||||
return
|
||||
end if
|
||||
idxmap%local_cols = ix
|
||||
ix = ix - idxmap%local_rows
|
||||
idxmap%loc_to_glob(ix) = idx(i)
|
||||
end if
|
||||
ix = ix + idxmap%local_rows
|
||||
idx(i) = ix
|
||||
else
|
||||
idx(i) = -1
|
||||
info = -1
|
||||
end if
|
||||
end do
|
||||
end if
|
||||
|
||||
else
|
||||
idx = -1
|
||||
info = -1
|
||||
end if
|
||||
|
||||
end subroutine block_g2lv1_ins
|
||||
|
||||
subroutine block_g2lv2_ins(idxin,idxout,idxmap,info,mask)
|
||||
implicit none
|
||||
class(psb_gen_block_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: idxin(:)
|
||||
integer, intent(out) :: idxout(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
integer :: is, im
|
||||
|
||||
is = size(idxin)
|
||||
im = min(is,size(idxout))
|
||||
idxout(1:im) = idxin(1:im)
|
||||
call idxmap%g2l_ins(idxout(1:im),info,mask)
|
||||
if (is > im) then
|
||||
!!$ write(0,*) 'g2lv2_ins err -3'
|
||||
info = -3
|
||||
end if
|
||||
|
||||
end subroutine block_g2lv2_ins
|
||||
|
||||
subroutine block_fnd_owner(idx,iprc,idxmap,info)
|
||||
use psb_penv_mod
|
||||
use psb_sort_mod
|
||||
implicit none
|
||||
integer, intent(in) :: idx(:)
|
||||
integer, allocatable, intent(out) :: iprc(:)
|
||||
class(psb_gen_block_map), intent(in) :: idxmap
|
||||
integer, intent(out) :: info
|
||||
integer :: ictxt, iam, np, nv, ip, i
|
||||
|
||||
ictxt = idxmap%get_ctxt()
|
||||
call psb_info(ictxt,iam,np)
|
||||
nv = size(idx)
|
||||
allocate(iprc(nv),stat=info)
|
||||
if (info /= 0) then
|
||||
!!$ write(0,*) 'Memory allocation failure in repl_map_fnd-owner'
|
||||
return
|
||||
end if
|
||||
do i=1, nv
|
||||
ip = psb_iblsrch(idx(i)-1,np+1,idxmap%vnl)
|
||||
iprc(i) = ip - 1
|
||||
end do
|
||||
|
||||
end subroutine block_fnd_owner
|
||||
|
||||
|
||||
|
||||
subroutine block_init(idxmap,ictxt,nl,info)
|
||||
use psb_penv_mod
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_gen_block_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: ictxt, nl
|
||||
integer, intent(out) :: info
|
||||
! To be implemented
|
||||
integer :: iam, np, i, j, ntot
|
||||
integer, allocatable :: vnl(:)
|
||||
|
||||
info = 0
|
||||
call psb_info(ictxt,iam,np)
|
||||
if (np < 0) then
|
||||
write(psb_err_unit,*) 'Invalid ictxt:',ictxt
|
||||
info = -1
|
||||
return
|
||||
end if
|
||||
allocate(vnl(0:np),stat=info)
|
||||
if (info /= 0) then
|
||||
info = -2
|
||||
return
|
||||
end if
|
||||
|
||||
vnl(:) = 0
|
||||
vnl(iam) = nl
|
||||
call psb_sum(ictxt,vnl)
|
||||
ntot = sum(vnl)
|
||||
vnl(1:np) = vnl(0:np-1)
|
||||
vnl(0) = 0
|
||||
do i=1,np
|
||||
vnl(i) = vnl(i) + vnl(i-1)
|
||||
end do
|
||||
if (ntot /= vnl(np)) then
|
||||
!!$ write(0,*) ' Mismatch in block_init ',ntot,vnl(np)
|
||||
end if
|
||||
|
||||
idxmap%global_rows = ntot
|
||||
idxmap%global_cols = ntot
|
||||
idxmap%local_rows = nl
|
||||
idxmap%local_cols = nl
|
||||
idxmap%ictxt = ictxt
|
||||
idxmap%state = psb_desc_bld_
|
||||
call psb_get_mpicomm(ictxt,idxmap%mpic)
|
||||
idxmap%min_glob_row = vnl(iam)+1
|
||||
idxmap%max_glob_row = vnl(iam+1)
|
||||
call move_alloc(vnl,idxmap%vnl)
|
||||
allocate(idxmap%loc_to_glob(nl),stat=info)
|
||||
if (info /= 0) then
|
||||
info = -2
|
||||
return
|
||||
end if
|
||||
call idxmap%set_state(psb_desc_bld_)
|
||||
|
||||
|
||||
end subroutine block_init
|
||||
|
||||
|
||||
subroutine block_asb(idxmap,info)
|
||||
use psb_penv_mod
|
||||
use psb_error_mod
|
||||
use psb_realloc_mod
|
||||
use psb_sort_mod
|
||||
implicit none
|
||||
class(psb_gen_block_map), intent(inout) :: idxmap
|
||||
integer, intent(out) :: info
|
||||
|
||||
integer :: nhal, ictxt, iam, np
|
||||
|
||||
info = 0
|
||||
ictxt = idxmap%get_ctxt()
|
||||
call psb_info(ictxt,iam,np)
|
||||
|
||||
nhal = idxmap%local_cols-idxmap%local_rows
|
||||
|
||||
call psb_realloc(nhal,idxmap%loc_to_glob,info)
|
||||
call psb_realloc(nhal,2,idxmap%srt_l2g,info)
|
||||
idxmap%srt_l2g(1:nhal,1) = idxmap%loc_to_glob(1:nhal)
|
||||
|
||||
call psb_qsort(idxmap%srt_l2g(:,1),&
|
||||
& ix=idxmap%srt_l2g(:,2),dir=psb_sort_up_)
|
||||
|
||||
call idxmap%set_state(psb_desc_asb_)
|
||||
|
||||
end subroutine block_asb
|
||||
|
||||
function block_get_fmt(idxmap) result(res)
|
||||
implicit none
|
||||
class(psb_gen_block_map), intent(in) :: idxmap
|
||||
character(len=5) :: res
|
||||
res = 'BLOCK'
|
||||
end function block_get_fmt
|
||||
|
||||
end module psb_gen_block_map_mod
|
@ -0,0 +1,144 @@
|
||||
module psb_glist_map_mod
|
||||
use psb_const_mod
|
||||
use psb_desc_const_mod
|
||||
use psb_list_map_mod
|
||||
|
||||
type, extends(psb_list_map) :: psb_glist_map
|
||||
integer, allocatable :: vgp(:)
|
||||
contains
|
||||
procedure, pass(idxmap) :: glist_map_init => glist_initvg
|
||||
procedure, pass(idxmap) :: sizeof => glist_sizeof
|
||||
procedure, pass(idxmap) :: free => glist_free
|
||||
procedure, pass(idxmap) :: get_fmt => glist_get_fmt
|
||||
procedure, pass(idxmap) :: fnd_owner => glist_fnd_owner
|
||||
|
||||
end type psb_glist_map
|
||||
|
||||
private :: glist_initvg, glist_sizeof, glist_free, glist_get_fmt
|
||||
|
||||
|
||||
contains
|
||||
|
||||
|
||||
function glist_sizeof(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_glist_map), intent(in) :: idxmap
|
||||
integer(psb_long_int_k_) :: val
|
||||
|
||||
val = idxmap%psb_list_map%sizeof()
|
||||
|
||||
if (allocated(idxmap%vgp)) &
|
||||
& val = val + size(idxmap%vgp)*psb_sizeof_int
|
||||
|
||||
end function glist_sizeof
|
||||
|
||||
|
||||
subroutine glist_free(idxmap)
|
||||
implicit none
|
||||
class(psb_glist_map), intent(inout) :: idxmap
|
||||
|
||||
if (allocated(idxmap%vgp)) &
|
||||
& deallocate(idxmap%vgp)
|
||||
|
||||
call idxmap%psb_list_map%free()
|
||||
|
||||
end subroutine glist_free
|
||||
|
||||
|
||||
|
||||
|
||||
subroutine glist_initvg(idxmap,ictxt,vg,info)
|
||||
use psb_penv_mod
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_glist_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: ictxt, vg(:)
|
||||
integer, intent(out) :: info
|
||||
! To be implemented
|
||||
integer :: iam, np, i, j, n, nl
|
||||
|
||||
|
||||
info = 0
|
||||
call psb_info(ictxt,iam,np)
|
||||
if (np < 0) then
|
||||
write(psb_err_unit,*) 'Invalid ictxt:',ictxt
|
||||
info = -1
|
||||
return
|
||||
end if
|
||||
n = size(vg)
|
||||
|
||||
idxmap%global_rows = n
|
||||
idxmap%global_cols = n
|
||||
|
||||
allocate(idxmap%loc_to_glob(n),idxmap%glob_to_loc(n),&
|
||||
& idxmap%vgp(n),stat=info)
|
||||
if (info /= 0) then
|
||||
info = -2
|
||||
return
|
||||
end if
|
||||
|
||||
idxmap%ictxt = ictxt
|
||||
idxmap%state = psb_desc_bld_
|
||||
call psb_get_mpicomm(ictxt,idxmap%mpic)
|
||||
|
||||
nl = 0
|
||||
do i=1, n
|
||||
if ((vg(i) > np-1).or.(vg(i) < 0)) then
|
||||
info=psb_err_partfunc_wrong_pid_
|
||||
exit
|
||||
end if
|
||||
idxmap%vgp(i) = vg(i)
|
||||
if (vg(i) == iam) then
|
||||
! this point belongs to me
|
||||
nl = nl + 1
|
||||
idxmap%glob_to_loc(i) = nl
|
||||
idxmap%loc_to_glob(nl) = i
|
||||
else
|
||||
idxmap%glob_to_loc(i) = -(np+vg(i)+1)
|
||||
end if
|
||||
end do
|
||||
|
||||
call idxmap%set_lr(nl)
|
||||
call idxmap%set_lc(nl)
|
||||
|
||||
end subroutine glist_initvg
|
||||
|
||||
subroutine glist_fnd_owner(idx,iprc,idxmap,info)
|
||||
use psb_penv_mod
|
||||
use psb_sort_mod
|
||||
implicit none
|
||||
integer, intent(in) :: idx(:)
|
||||
integer, allocatable, intent(out) :: iprc(:)
|
||||
class(psb_glist_map), intent(in) :: idxmap
|
||||
integer, intent(out) :: info
|
||||
integer :: ictxt, iam, np, nv, ip, i, ngp
|
||||
|
||||
ictxt = idxmap%get_ctxt()
|
||||
call psb_info(ictxt,iam,np)
|
||||
nv = size(idx)
|
||||
allocate(iprc(nv),stat=info)
|
||||
if (info /= 0) then
|
||||
write(0,*) 'Memory allocation failure in repl_map_fnd-owner'
|
||||
return
|
||||
end if
|
||||
|
||||
ngp = size(idxmap%vgp)
|
||||
do i=1, nv
|
||||
if ((1<=idx(i)).and.(idx(i)<ngp)) then
|
||||
iprc(i) = idxmap%vgp(idx(i))
|
||||
else
|
||||
iprc(i) = -1
|
||||
end if
|
||||
end do
|
||||
|
||||
end subroutine glist_fnd_owner
|
||||
|
||||
function glist_get_fmt(idxmap) result(res)
|
||||
implicit none
|
||||
class(psb_glist_map), intent(in) :: idxmap
|
||||
character(len=5) :: res
|
||||
res = 'GLIST'
|
||||
end function glist_get_fmt
|
||||
|
||||
|
||||
end module psb_glist_map_mod
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,718 @@
|
||||
module psb_indx_map_mod
|
||||
use psb_const_mod
|
||||
use psb_desc_const_mod
|
||||
|
||||
type :: psb_indx_map
|
||||
|
||||
integer :: state = psb_desc_null_
|
||||
integer :: ictxt = -1
|
||||
integer :: mpic = -1
|
||||
integer :: global_rows = -1
|
||||
integer :: global_cols = -1
|
||||
integer :: local_rows = -1
|
||||
integer :: local_cols = -1
|
||||
|
||||
contains
|
||||
|
||||
procedure, pass(idxmap) :: get_state => base_get_state
|
||||
procedure, pass(idxmap) :: set_state => base_set_state
|
||||
procedure, pass(idxmap) :: is_null => base_is_null
|
||||
procedure, pass(idxmap) :: is_repl => base_is_repl
|
||||
procedure, pass(idxmap) :: is_bld => base_is_bld
|
||||
procedure, pass(idxmap) :: is_upd => base_is_upd
|
||||
procedure, pass(idxmap) :: is_asb => base_is_asb
|
||||
procedure, pass(idxmap) :: is_valid => base_is_valid
|
||||
procedure, pass(idxmap) :: is_ovl => base_is_ovl
|
||||
procedure, pass(idxmap) :: get_gr => base_get_gr
|
||||
procedure, pass(idxmap) :: get_gc => base_get_gc
|
||||
procedure, pass(idxmap) :: get_lr => base_get_lr
|
||||
procedure, pass(idxmap) :: get_lc => base_get_lc
|
||||
procedure, pass(idxmap) :: get_ctxt => base_get_ctxt
|
||||
procedure, pass(idxmap) :: get_mpic => base_get_mpic
|
||||
procedure, pass(idxmap) :: sizeof => base_sizeof
|
||||
procedure, pass(idxmap) :: set_null => base_set_null
|
||||
procedure, pass(idxmap) :: row_extendable => base_row_extendable
|
||||
|
||||
procedure, pass(idxmap) :: set_gr => base_set_gr
|
||||
procedure, pass(idxmap) :: set_gc => base_set_gc
|
||||
procedure, pass(idxmap) :: set_lr => base_set_lr
|
||||
procedure, pass(idxmap) :: set_lc => base_set_lc
|
||||
procedure, pass(idxmap) :: set_ctxt => base_set_ctxt
|
||||
procedure, pass(idxmap) :: set_mpic => base_set_mpic
|
||||
|
||||
procedure, pass(idxmap) :: get_fmt => base_get_fmt
|
||||
|
||||
procedure, pass(idxmap) :: asb => base_asb
|
||||
procedure, pass(idxmap) :: free => base_free
|
||||
|
||||
procedure, pass(idxmap) :: l2gs1 => base_l2gs1
|
||||
procedure, pass(idxmap) :: l2gs2 => base_l2gs2
|
||||
procedure, pass(idxmap) :: l2gv1 => base_l2gv1
|
||||
procedure, pass(idxmap) :: l2gv2 => base_l2gv2
|
||||
generic, public :: l2g => l2gs1, l2gs2, l2gv1, l2gv2
|
||||
|
||||
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 :: g2l => g2ls1, g2ls2, g2lv1, g2lv2
|
||||
|
||||
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_ins => g2ls1_ins, g2ls2_ins,&
|
||||
& g2lv1_ins, g2lv2_ins
|
||||
|
||||
procedure, pass(idxmap) :: fnd_owner => psb_indx_map_fnd_owner
|
||||
procedure, pass(idxmap) :: init_vl => base_init_vl
|
||||
generic, public :: init => init_vl
|
||||
|
||||
end type psb_indx_map
|
||||
|
||||
private :: base_get_state, base_set_state, base_is_repl, base_is_bld,&
|
||||
& base_is_upd, base_is_asb, base_is_valid, base_is_ovl,&
|
||||
& base_get_gr, base_get_gc, base_get_lr, base_get_lc, base_get_ctxt,&
|
||||
& base_get_mpic, base_sizeof, base_set_null, base_set_gr,&
|
||||
& base_set_gc, base_set_lr, base_set_lc, base_set_ctxt,&
|
||||
& base_set_mpic, base_get_fmt, base_asb, base_free,&
|
||||
& base_l2gs1, base_l2gs2, base_l2gv1, base_l2gv2,&
|
||||
& base_g2ls1, base_g2ls2, base_g2lv1, base_g2lv2,&
|
||||
& base_g2ls1_ins, base_g2ls2_ins, base_g2lv1_ins,&
|
||||
& base_g2lv2_ins, base_init_vl, base_is_null, base_row_extendable
|
||||
|
||||
interface
|
||||
subroutine psb_indx_map_fnd_owner(idx,iprc,idxmap,info)
|
||||
import :: psb_indx_map
|
||||
implicit none
|
||||
integer, intent(in) :: idx(:)
|
||||
integer, allocatable, intent(out) :: iprc(:)
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer, intent(out) :: info
|
||||
end subroutine psb_indx_map_fnd_owner
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
function base_get_state(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer :: val
|
||||
|
||||
val = idxmap%state
|
||||
|
||||
end function base_get_state
|
||||
|
||||
|
||||
function base_get_gr(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer :: val
|
||||
|
||||
val = idxmap%global_rows
|
||||
|
||||
end function base_get_gr
|
||||
|
||||
|
||||
function base_get_gc(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer :: val
|
||||
|
||||
val = idxmap%global_cols
|
||||
|
||||
end function base_get_gc
|
||||
|
||||
|
||||
function base_get_lr(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer :: val
|
||||
|
||||
val = idxmap%local_rows
|
||||
|
||||
end function base_get_lr
|
||||
|
||||
|
||||
function base_get_lc(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer :: val
|
||||
|
||||
val = idxmap%local_cols
|
||||
|
||||
end function base_get_lc
|
||||
|
||||
|
||||
function base_get_ctxt(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer :: val
|
||||
|
||||
val = idxmap%ictxt
|
||||
|
||||
end function base_get_ctxt
|
||||
|
||||
|
||||
function base_get_mpic(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer :: val
|
||||
|
||||
val = idxmap%mpic
|
||||
|
||||
end function base_get_mpic
|
||||
|
||||
|
||||
subroutine base_set_state(idxmap,val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: val
|
||||
|
||||
idxmap%state = val
|
||||
end subroutine base_set_state
|
||||
|
||||
subroutine base_set_ctxt(idxmap,val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: val
|
||||
|
||||
idxmap%ictxt = val
|
||||
end subroutine base_set_ctxt
|
||||
|
||||
subroutine base_set_gr(idxmap,val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: val
|
||||
|
||||
idxmap%global_rows = val
|
||||
end subroutine base_set_gr
|
||||
|
||||
subroutine base_set_gc(idxmap,val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: val
|
||||
|
||||
idxmap%global_cols = val
|
||||
end subroutine base_set_gc
|
||||
|
||||
subroutine base_set_lr(idxmap,val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: val
|
||||
|
||||
idxmap%local_rows = val
|
||||
end subroutine base_set_lr
|
||||
|
||||
subroutine base_set_lc(idxmap,val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: val
|
||||
|
||||
idxmap%local_cols = val
|
||||
end subroutine base_set_lc
|
||||
|
||||
subroutine base_set_mpic(idxmap,val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: val
|
||||
|
||||
idxmap%mpic = val
|
||||
end subroutine base_set_mpic
|
||||
|
||||
|
||||
function base_row_extendable(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
logical :: val
|
||||
val = .false.
|
||||
end function base_row_extendable
|
||||
|
||||
function base_is_repl(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
logical :: val
|
||||
val = .false.
|
||||
end function base_is_repl
|
||||
|
||||
function base_is_null(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
logical :: val
|
||||
val = (idxmap%state == psb_desc_null_)
|
||||
end function base_is_null
|
||||
|
||||
|
||||
function base_is_bld(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
logical :: val
|
||||
val = (idxmap%state == psb_desc_bld_).or.&
|
||||
& (idxmap%state == psb_desc_ovl_bld_)
|
||||
end function base_is_bld
|
||||
|
||||
function base_is_upd(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
logical :: val
|
||||
val = (idxmap%state == psb_desc_upd_)
|
||||
end function base_is_upd
|
||||
|
||||
function base_is_asb(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
logical :: val
|
||||
val = (idxmap%state == psb_desc_asb_).or.&
|
||||
& (idxmap%state == psb_desc_ovl_asb_)
|
||||
end function base_is_asb
|
||||
|
||||
function base_is_valid(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
logical :: val
|
||||
val = idxmap%is_bld().or.idxmap%is_upd().or.idxmap%is_asb()
|
||||
end function base_is_valid
|
||||
|
||||
|
||||
function base_is_ovl(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
logical :: val
|
||||
val = (idxmap%state == psb_desc_ovl_bld_).or.&
|
||||
& (idxmap%state == psb_desc_ovl_asb_)
|
||||
end function base_is_ovl
|
||||
|
||||
function base_sizeof(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer(psb_long_int_k_) :: val
|
||||
|
||||
val = 8 * psb_sizeof_int
|
||||
end function base_sizeof
|
||||
|
||||
|
||||
! !!!!!!!!!!!!!!!!
|
||||
!
|
||||
! !!!!!!!!!!!!!!!!
|
||||
subroutine base_l2gs1(idx,idxmap,info,mask,owned)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer, intent(inout) :: idx
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='base_l2g'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_get_erraction(err_act)
|
||||
! This is the base version. If we get here
|
||||
! it means the derived class is incomplete,
|
||||
! so we throw an error.
|
||||
call psb_errpush(psb_err_missing_override_method_,&
|
||||
& name,a_err=idxmap%get_fmt())
|
||||
|
||||
if (err_act /= psb_act_ret_) then
|
||||
call psb_error()
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine base_l2gs1
|
||||
|
||||
subroutine base_l2gs2(idxin,idxout,idxmap,info,mask,owned)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer, intent(in) :: idxin
|
||||
integer, intent(out) :: idxout
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='base_l2g'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_get_erraction(err_act)
|
||||
! This is the base version. If we get here
|
||||
! it means the derived class is incomplete,
|
||||
! so we throw an error.
|
||||
call psb_errpush(psb_err_missing_override_method_,&
|
||||
& name,a_err=idxmap%get_fmt())
|
||||
|
||||
if (err_act /= psb_act_ret_) then
|
||||
call psb_error()
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine base_l2gs2
|
||||
|
||||
|
||||
subroutine base_l2gv1(idx,idxmap,info,mask,owned)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer, intent(inout) :: idx(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='base_l2g'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_get_erraction(err_act)
|
||||
! This is the base version. If we get here
|
||||
! it means the derived class is incomplete,
|
||||
! so we throw an error.
|
||||
call psb_errpush(psb_err_missing_override_method_,&
|
||||
& name,a_err=idxmap%get_fmt())
|
||||
|
||||
if (err_act /= psb_act_ret_) then
|
||||
call psb_error()
|
||||
end if
|
||||
return
|
||||
end subroutine base_l2gv1
|
||||
|
||||
subroutine base_l2gv2(idxin,idxout,idxmap,info,mask,owned)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer, intent(in) :: idxin(:)
|
||||
integer, intent(out) :: idxout(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='base_l2g'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_get_erraction(err_act)
|
||||
! This is the base version. If we get here
|
||||
! it means the derived class is incomplete,
|
||||
! so we throw an error.
|
||||
call psb_errpush(psb_err_missing_override_method_,&
|
||||
& name,a_err=idxmap%get_fmt())
|
||||
|
||||
if (err_act /= psb_act_ret_) then
|
||||
call psb_error()
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine base_l2gv2
|
||||
|
||||
|
||||
subroutine base_g2ls1(idx,idxmap,info,mask,owned)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer, intent(inout) :: idx
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='base_g2l'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_get_erraction(err_act)
|
||||
! This is the base version. If we get here
|
||||
! it means the derived class is incomplete,
|
||||
! so we throw an error.
|
||||
call psb_errpush(psb_err_missing_override_method_,&
|
||||
& name,a_err=idxmap%get_fmt())
|
||||
|
||||
if (err_act /= psb_act_ret_) then
|
||||
call psb_error()
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine base_g2ls1
|
||||
|
||||
subroutine base_g2ls2(idxin,idxout,idxmap,info,mask,owned)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer, intent(in) :: idxin
|
||||
integer, intent(out) :: idxout
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='base_g2l'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_get_erraction(err_act)
|
||||
! This is the base version. If we get here
|
||||
! it means the derived class is incomplete,
|
||||
! so we throw an error.
|
||||
call psb_errpush(psb_err_missing_override_method_,&
|
||||
& name,a_err=idxmap%get_fmt())
|
||||
|
||||
if (err_act /= psb_act_ret_) then
|
||||
call psb_error()
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine base_g2ls2
|
||||
|
||||
|
||||
subroutine base_g2lv1(idx,idxmap,info,mask,owned)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer, intent(inout) :: idx(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='base_g2l'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_get_erraction(err_act)
|
||||
! This is the base version. If we get here
|
||||
! it means the derived class is incomplete,
|
||||
! so we throw an error.
|
||||
call psb_errpush(psb_err_missing_override_method_,&
|
||||
& name,a_err=idxmap%get_fmt())
|
||||
|
||||
if (err_act /= psb_act_ret_) then
|
||||
call psb_error()
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine base_g2lv1
|
||||
|
||||
subroutine base_g2lv2(idxin,idxout,idxmap,info,mask,owned)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer, intent(in) :: idxin(:)
|
||||
integer, intent(out) :: idxout(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='base_g2l'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_get_erraction(err_act)
|
||||
! This is the base version. If we get here
|
||||
! it means the derived class is incomplete,
|
||||
! so we throw an error.
|
||||
call psb_errpush(psb_err_missing_override_method_,&
|
||||
& name,a_err=idxmap%get_fmt())
|
||||
|
||||
if (err_act /= psb_act_ret_) then
|
||||
call psb_error()
|
||||
end if
|
||||
return
|
||||
|
||||
|
||||
end subroutine base_g2lv2
|
||||
|
||||
|
||||
|
||||
subroutine base_g2ls1_ins(idx,idxmap,info,mask)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
integer, intent(inout) :: idx
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='base_g2l_ins'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_get_erraction(err_act)
|
||||
! This is the base version. If we get here
|
||||
! it means the derived class is incomplete,
|
||||
! so we throw an error.
|
||||
call psb_errpush(psb_err_missing_override_method_,&
|
||||
& name,a_err=idxmap%get_fmt())
|
||||
|
||||
if (err_act /= psb_act_ret_) then
|
||||
call psb_error()
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine base_g2ls1_ins
|
||||
|
||||
subroutine base_g2ls2_ins(idxin,idxout,idxmap,info,mask)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: idxin
|
||||
integer, intent(out) :: idxout
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='base_g2l_ins'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_get_erraction(err_act)
|
||||
! This is the base version. If we get here
|
||||
! it means the derived class is incomplete,
|
||||
! so we throw an error.
|
||||
call psb_errpush(psb_err_missing_override_method_,&
|
||||
& name,a_err=idxmap%get_fmt())
|
||||
|
||||
if (err_act /= psb_act_ret_) then
|
||||
call psb_error()
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine base_g2ls2_ins
|
||||
|
||||
|
||||
subroutine base_g2lv1_ins(idx,idxmap,info,mask)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
integer, intent(inout) :: idx(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='base_g2l_ins'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_get_erraction(err_act)
|
||||
! This is the base version. If we get here
|
||||
! it means the derived class is incomplete,
|
||||
! so we throw an error.
|
||||
call psb_errpush(psb_err_missing_override_method_,&
|
||||
& name,a_err=idxmap%get_fmt())
|
||||
|
||||
if (err_act /= psb_act_ret_) then
|
||||
call psb_error()
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine base_g2lv1_ins
|
||||
|
||||
subroutine base_g2lv2_ins(idxin,idxout,idxmap,info,mask)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: idxin(:)
|
||||
integer, intent(out) :: idxout(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='base_g2l_ins'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_get_erraction(err_act)
|
||||
! This is the base version. If we get here
|
||||
! it means the derived class is incomplete,
|
||||
! so we throw an error.
|
||||
call psb_errpush(psb_err_missing_override_method_,&
|
||||
& name,a_err=idxmap%get_fmt())
|
||||
|
||||
if (err_act /= psb_act_ret_) then
|
||||
call psb_error()
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine base_g2lv2_ins
|
||||
|
||||
|
||||
subroutine base_asb(idxmap,info)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
integer, intent(out) :: info
|
||||
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='base_asb'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_get_erraction(err_act)
|
||||
! This is the base version. If we get here
|
||||
! it means the derived class is incomplete,
|
||||
! so we throw an error.
|
||||
call psb_errpush(psb_err_missing_override_method_,&
|
||||
& name,a_err=idxmap%get_fmt())
|
||||
|
||||
if (err_act /= psb_act_ret_) then
|
||||
call psb_error()
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine base_asb
|
||||
|
||||
subroutine base_free(idxmap)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='base_free'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
! almost nothing to be done here
|
||||
idxmap%state = -1
|
||||
idxmap%ictxt = -1
|
||||
idxmap%mpic = -1
|
||||
idxmap%global_rows = -1
|
||||
idxmap%global_cols = -1
|
||||
idxmap%local_rows = -1
|
||||
idxmap%local_cols = -1
|
||||
|
||||
return
|
||||
|
||||
end subroutine base_free
|
||||
|
||||
subroutine base_set_null(idxmap)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
|
||||
idxmap%state = psb_desc_null_
|
||||
idxmap%ictxt = -1
|
||||
idxmap%mpic = -1
|
||||
idxmap%global_rows = -1
|
||||
idxmap%global_cols = -1
|
||||
idxmap%local_rows = -1
|
||||
idxmap%local_cols = -1
|
||||
|
||||
end subroutine base_set_null
|
||||
|
||||
|
||||
function base_get_fmt(idxmap) result(res)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
character(len=5) :: res
|
||||
res = 'NULL'
|
||||
end function base_get_fmt
|
||||
|
||||
|
||||
subroutine base_init_vl(idxmap,ictxt,vl,info)
|
||||
use psb_penv_mod
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: ictxt, vl(:)
|
||||
integer, intent(out) :: info
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='base_init_vl'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_get_erraction(err_act)
|
||||
! This is the base version. If we get here
|
||||
! it means the derived class is incomplete,
|
||||
! so we throw an error.
|
||||
call psb_errpush(psb_err_missing_override_method_,&
|
||||
& name,a_err=idxmap%get_fmt())
|
||||
|
||||
if (err_act /= psb_act_ret_) then
|
||||
call psb_error()
|
||||
end if
|
||||
return
|
||||
end subroutine base_init_vl
|
||||
|
||||
|
||||
|
||||
end module psb_indx_map_mod
|
@ -0,0 +1,593 @@
|
||||
module psb_list_map_mod
|
||||
use psb_const_mod
|
||||
use psb_desc_const_mod
|
||||
use psb_indx_map_mod
|
||||
|
||||
type, extends(psb_indx_map) :: psb_list_map
|
||||
integer :: pnt_h = -1
|
||||
integer, allocatable :: loc_to_glob(:), glob_to_loc(:)
|
||||
contains
|
||||
procedure, pass(idxmap) :: init_vl => list_initvl
|
||||
|
||||
procedure, pass(idxmap) :: sizeof => list_sizeof
|
||||
procedure, pass(idxmap) :: asb => list_asb
|
||||
procedure, pass(idxmap) :: free => list_free
|
||||
procedure, pass(idxmap) :: get_fmt => list_get_fmt
|
||||
procedure, pass(idxmap) :: 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) :: 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_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
|
||||
|
||||
end type psb_list_map
|
||||
|
||||
private :: list_initvl, list_sizeof, list_asb, list_free,&
|
||||
& list_get_fmt, list_l2gs1, list_l2gs2, list_l2gv1,&
|
||||
& list_l2gv2, list_g2ls1, list_g2ls2, list_g2lv1,&
|
||||
& list_g2lv2, list_g2ls1_ins, list_g2ls2_ins,&
|
||||
& list_g2lv1_ins, list_g2lv2_ins, list_row_extendable
|
||||
|
||||
contains
|
||||
|
||||
function list_row_extendable(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_list_map), intent(in) :: idxmap
|
||||
logical :: val
|
||||
val = .true.
|
||||
end function list_row_extendable
|
||||
|
||||
function list_sizeof(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_list_map), intent(in) :: idxmap
|
||||
integer(psb_long_int_k_) :: val
|
||||
|
||||
val = idxmap%psb_indx_map%sizeof()
|
||||
|
||||
if (allocated(idxmap%loc_to_glob)) &
|
||||
& val = val + size(idxmap%loc_to_glob)*psb_sizeof_int
|
||||
if (allocated(idxmap%glob_to_loc)) &
|
||||
& val = val + size(idxmap%glob_to_loc)*psb_sizeof_int
|
||||
|
||||
end function list_sizeof
|
||||
|
||||
|
||||
subroutine list_free(idxmap)
|
||||
implicit none
|
||||
class(psb_list_map), intent(inout) :: idxmap
|
||||
|
||||
if (allocated(idxmap%loc_to_glob)) &
|
||||
& deallocate(idxmap%loc_to_glob)
|
||||
if (allocated(idxmap%glob_to_loc)) &
|
||||
& deallocate(idxmap%glob_to_loc)
|
||||
|
||||
call idxmap%psb_indx_map%free()
|
||||
|
||||
end subroutine list_free
|
||||
|
||||
|
||||
subroutine list_l2gs1(idx,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_list_map), intent(in) :: idxmap
|
||||
integer, intent(inout) :: idx
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
integer :: idxv(1)
|
||||
info = 0
|
||||
if (present(mask)) then
|
||||
if (.not.mask) return
|
||||
end if
|
||||
|
||||
idxv(1) = idx
|
||||
call idxmap%l2g(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, intent(in) :: idxin
|
||||
integer, intent(out) :: idxout
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
idxout = idxin
|
||||
call idxmap%l2g(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, intent(inout) :: idx(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
integer :: 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, intent(in) :: idxin(:)
|
||||
integer, intent(out) :: idxout(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
integer :: is, im
|
||||
|
||||
is = size(idxin)
|
||||
im = min(is,size(idxout))
|
||||
idxout(1:im) = idxin(1:im)
|
||||
call idxmap%l2g(idxout(1:im),info,mask,owned)
|
||||
if (is > im) info = -3
|
||||
|
||||
end subroutine list_l2gv2
|
||||
|
||||
|
||||
subroutine list_g2ls1(idx,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_list_map), intent(in) :: idxmap
|
||||
integer, intent(inout) :: idx
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
integer :: idxv(1)
|
||||
info = 0
|
||||
|
||||
if (present(mask)) then
|
||||
if (.not.mask) return
|
||||
end if
|
||||
|
||||
idxv(1) = idx
|
||||
call idxmap%g2l(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, intent(in) :: idxin
|
||||
integer, intent(out) :: idxout
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
idxout = idxin
|
||||
call idxmap%g2l(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, intent(inout) :: idx(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
integer :: i, nv, 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, intent(in) :: idxin(:)
|
||||
integer, intent(out) :: idxout(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
integer :: is, im
|
||||
|
||||
is = size(idxin)
|
||||
im = min(is,size(idxout))
|
||||
idxout(1:im) = idxin(1:im)
|
||||
call idxmap%g2l(idxout(1:im),info,mask,owned)
|
||||
if (is > im) info = -3
|
||||
|
||||
end subroutine list_g2lv2
|
||||
|
||||
|
||||
|
||||
subroutine list_g2ls1_ins(idx,idxmap,info,mask)
|
||||
use psb_realloc_mod
|
||||
use psb_sort_mod
|
||||
implicit none
|
||||
class(psb_list_map), intent(inout) :: idxmap
|
||||
integer, intent(inout) :: idx
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
|
||||
integer :: idxv(1)
|
||||
|
||||
info = 0
|
||||
if (present(mask)) then
|
||||
if (.not.mask) return
|
||||
end if
|
||||
idxv(1) = idx
|
||||
call idxmap%g2l_ins(idxv,info)
|
||||
idx = idxv(1)
|
||||
|
||||
end subroutine list_g2ls1_ins
|
||||
|
||||
subroutine list_g2ls2_ins(idxin,idxout,idxmap,info,mask)
|
||||
implicit none
|
||||
class(psb_list_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: idxin
|
||||
integer, intent(out) :: idxout
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
|
||||
idxout = idxin
|
||||
call idxmap%g2l_ins(idxout,info)
|
||||
|
||||
end subroutine list_g2ls2_ins
|
||||
|
||||
|
||||
subroutine list_g2lv1_ins(idx,idxmap,info,mask)
|
||||
use psb_realloc_mod
|
||||
use psb_sort_mod
|
||||
implicit none
|
||||
class(psb_list_map), intent(inout) :: idxmap
|
||||
integer, intent(inout) :: idx(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
integer :: i, nv, is, ix
|
||||
|
||||
info = 0
|
||||
is = size(idx)
|
||||
|
||||
if (present(mask)) then
|
||||
if (size(mask) < 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(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=500)
|
||||
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=500)
|
||||
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
|
||||
|
||||
else
|
||||
idx = -1
|
||||
info = -1
|
||||
end if
|
||||
|
||||
end subroutine list_g2lv1_ins
|
||||
|
||||
subroutine list_g2lv2_ins(idxin,idxout,idxmap,info,mask)
|
||||
implicit none
|
||||
class(psb_list_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: idxin(:)
|
||||
integer, intent(out) :: idxout(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
integer :: is, im
|
||||
|
||||
is = size(idxin)
|
||||
im = min(is,size(idxout))
|
||||
idxout(1:im) = idxin(1:im)
|
||||
call idxmap%g2l_ins(idxout(1:im),info,mask)
|
||||
if (is > im) info = -3
|
||||
|
||||
end subroutine list_g2lv2_ins
|
||||
|
||||
|
||||
|
||||
!!$
|
||||
!!$ subroutine list_initvg(idxmap,vg,ictxt,info)
|
||||
!!$ use psb_penv_mod
|
||||
!!$ use psb_error_mod
|
||||
!!$ implicit none
|
||||
!!$ class(psb_list_map), intent(inout) :: idxmap
|
||||
!!$ integer, intent(in) :: ictxt, vg(:)
|
||||
!!$ integer, intent(out) :: info
|
||||
!!$ ! To be implemented
|
||||
!!$ integer :: iam, np, i, j, n, nl
|
||||
!!$
|
||||
!!$
|
||||
!!$ info = 0
|
||||
!!$ call psb_info(ictxt,iam,np)
|
||||
!!$ if (np < 0) then
|
||||
!!$ write(psb_err_unit,*) 'Invalid ictxt:',ictxt
|
||||
!!$ info = -1
|
||||
!!$ return
|
||||
!!$ end if
|
||||
!!$ n = size(vg)
|
||||
!!$
|
||||
!!$ idxmap%global_rows = n
|
||||
!!$ idxmap%global_cols = n
|
||||
!!$
|
||||
!!$ allocate(idxmap%loc_to_glob(n),idxmap%glob_to_loc(n),&
|
||||
!!$ & stat=info)
|
||||
!!$ if (info /= 0) then
|
||||
!!$ info = -2
|
||||
!!$ return
|
||||
!!$ end if
|
||||
!!$
|
||||
!!$ idxmap%ictxt = ictxt
|
||||
!!$ idxmap%state = psb_desc_bld_
|
||||
!!$ call psb_get_mpicomm(ictxt,idxmap%mpic)
|
||||
!!$
|
||||
!!$ nl = 0
|
||||
!!$ do i=1, n
|
||||
!!$ if ((vg(i) > np-1).or.(vg(i) < 0)) then
|
||||
!!$ info=psb_err_partfunc_wrong_pid_
|
||||
!!$ exit
|
||||
!!$ end if
|
||||
!!$ if (vg(i) == iam) then
|
||||
!!$ ! this point belongs to me
|
||||
!!$ nl = nl + 1
|
||||
!!$ idxmap%glob_to_loc(i) = nl
|
||||
!!$ idxmap%loc_to_glob(nl) = i
|
||||
!!$ else
|
||||
!!$ idxmap%glob_to_loc(i) = -(np+vg(i)+1)
|
||||
!!$ end if
|
||||
!!$ end do
|
||||
!!$
|
||||
!!$ call idxmap%set_lr(nl)
|
||||
!!$ call idxmap%set_lc(nl)
|
||||
!!$
|
||||
!!$ end subroutine list_initvg
|
||||
!!$
|
||||
|
||||
subroutine list_initvl(idxmap,ictxt,vL,info)
|
||||
use psb_penv_mod
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_list_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: ictxt, vl(:)
|
||||
integer, intent(out) :: info
|
||||
! To be implemented
|
||||
integer :: iam, np, i, ix, nl, n, nrt
|
||||
|
||||
info = 0
|
||||
call psb_info(ictxt,iam,np)
|
||||
if (np < 0) then
|
||||
write(psb_err_unit,*) 'Invalid ictxt:',ictxt
|
||||
info = -1
|
||||
return
|
||||
end if
|
||||
|
||||
nl = size(vl)
|
||||
|
||||
|
||||
n = maxval(vl(1:nl))
|
||||
nrt = nl
|
||||
call psb_sum(ictxt,nrt)
|
||||
call psb_max(ictxt,n)
|
||||
|
||||
|
||||
if (n /= nrt) then
|
||||
write(psb_err_unit,*) 'Size mismatch', n, nrt
|
||||
info = -1
|
||||
return
|
||||
end if
|
||||
|
||||
idxmap%global_rows = n
|
||||
idxmap%global_cols = n
|
||||
|
||||
allocate(idxmap%loc_to_glob(n),idxmap%glob_to_loc(n),stat=info)
|
||||
if (info /= 0) then
|
||||
info = -2
|
||||
return
|
||||
end if
|
||||
|
||||
idxmap%ictxt = ictxt
|
||||
idxmap%state = psb_desc_bld_
|
||||
call psb_get_mpicomm(ictxt,idxmap%mpic)
|
||||
do i=1, n
|
||||
idxmap%glob_to_loc(i) = -1
|
||||
end do
|
||||
|
||||
do i=1, nl
|
||||
ix = vl(i)
|
||||
idxmap%loc_to_glob(i) = ix
|
||||
idxmap%glob_to_loc(ix) = i
|
||||
end do
|
||||
|
||||
idxmap%local_rows = nl
|
||||
idxmap%local_cols = nl
|
||||
call idxmap%set_state(psb_desc_bld_)
|
||||
|
||||
end subroutine list_initvl
|
||||
|
||||
|
||||
subroutine list_asb(idxmap,info)
|
||||
use psb_penv_mod
|
||||
use psb_error_mod
|
||||
use psb_realloc_mod
|
||||
use psb_sort_mod
|
||||
implicit none
|
||||
class(psb_list_map), intent(inout) :: idxmap
|
||||
integer, intent(out) :: info
|
||||
|
||||
integer :: nhal, ictxt, iam, np
|
||||
|
||||
info = 0
|
||||
ictxt = idxmap%get_ctxt()
|
||||
call psb_info(ictxt,iam,np)
|
||||
|
||||
nhal = idxmap%local_cols
|
||||
call psb_realloc(nhal,idxmap%loc_to_glob,info)
|
||||
|
||||
call idxmap%set_state(psb_desc_asb_)
|
||||
|
||||
end subroutine list_asb
|
||||
|
||||
function list_get_fmt(idxmap) result(res)
|
||||
implicit none
|
||||
class(psb_list_map), intent(in) :: idxmap
|
||||
character(len=5) :: res
|
||||
res = 'LIST'
|
||||
end function list_get_fmt
|
||||
|
||||
|
||||
end module psb_list_map_mod
|
@ -0,0 +1,502 @@
|
||||
module psb_repl_map_mod
|
||||
use psb_const_mod
|
||||
use psb_desc_const_mod
|
||||
use psb_indx_map_mod
|
||||
|
||||
type, extends(psb_indx_map) :: psb_repl_map
|
||||
|
||||
contains
|
||||
|
||||
procedure, pass(idxmap) :: repl_map_init => repl_init
|
||||
|
||||
procedure, pass(idxmap) :: is_repl => repl_is_repl
|
||||
procedure, pass(idxmap) :: asb => repl_asb
|
||||
procedure, pass(idxmap) :: free => repl_free
|
||||
procedure, pass(idxmap) :: 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) :: g2ls1 => repl_g2ls1
|
||||
procedure, pass(idxmap) :: g2ls2 => repl_g2ls2
|
||||
procedure, pass(idxmap) :: g2lv1 => repl_g2lv1
|
||||
procedure, pass(idxmap) :: g2lv2 => 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) :: fnd_owner => repl_fnd_owner
|
||||
|
||||
end type psb_repl_map
|
||||
|
||||
private :: repl_init, repl_is_repl, repl_asb, repl_free,&
|
||||
& repl_get_fmt, repl_l2gs1, repl_l2gs2, repl_l2gv1,&
|
||||
& repl_l2gv2, repl_g2ls1, repl_g2ls2, repl_g2lv1,&
|
||||
& repl_g2lv2, repl_g2ls1_ins, repl_g2ls2_ins,&
|
||||
& repl_g2lv1_ins, repl_g2lv2_ins
|
||||
|
||||
|
||||
contains
|
||||
|
||||
function repl_is_repl(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(in) :: idxmap
|
||||
logical :: val
|
||||
val = .true.
|
||||
end function repl_is_repl
|
||||
|
||||
|
||||
function repl_sizeof(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(in) :: idxmap
|
||||
integer(psb_long_int_k_) :: val
|
||||
|
||||
val = idxmap%psb_indx_map%sizeof()
|
||||
|
||||
end function repl_sizeof
|
||||
|
||||
|
||||
|
||||
subroutine repl_l2gs1(idx,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(in) :: idxmap
|
||||
integer, intent(inout) :: idx
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
integer :: idxv(1)
|
||||
info = 0
|
||||
if (present(mask)) then
|
||||
if (.not.mask) return
|
||||
end if
|
||||
|
||||
idxv(1) = idx
|
||||
call idxmap%l2g(idxv,info,owned=owned)
|
||||
idx = idxv(1)
|
||||
|
||||
end subroutine repl_l2gs1
|
||||
|
||||
subroutine repl_l2gs2(idxin,idxout,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(in) :: idxmap
|
||||
integer, intent(in) :: idxin
|
||||
integer, intent(out) :: idxout
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
idxout = idxin
|
||||
call idxmap%l2g(idxout,info,mask,owned)
|
||||
|
||||
end subroutine repl_l2gs2
|
||||
|
||||
|
||||
subroutine repl_l2gv1(idx,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(in) :: idxmap
|
||||
integer, intent(inout) :: idx(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
integer :: 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
|
||||
! do nothing
|
||||
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%local_rows)) then
|
||||
! do nothing
|
||||
else
|
||||
idx(i) = -1
|
||||
end if
|
||||
end do
|
||||
|
||||
end if
|
||||
|
||||
end subroutine repl_l2gv1
|
||||
|
||||
subroutine repl_l2gv2(idxin,idxout,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(in) :: idxmap
|
||||
integer, intent(in) :: idxin(:)
|
||||
integer, intent(out) :: idxout(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
integer :: is, im
|
||||
|
||||
is = size(idxin)
|
||||
im = min(is,size(idxout))
|
||||
idxout(1:im) = idxin(1:im)
|
||||
call idxmap%l2g(idxout(1:im),info,mask,owned)
|
||||
if (is > im) info = -3
|
||||
|
||||
end subroutine repl_l2gv2
|
||||
|
||||
|
||||
subroutine repl_g2ls1(idx,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(in) :: idxmap
|
||||
integer, intent(inout) :: idx
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
integer :: idxv(1)
|
||||
info = 0
|
||||
|
||||
if (present(mask)) then
|
||||
if (.not.mask) return
|
||||
end if
|
||||
|
||||
idxv(1) = idx
|
||||
call idxmap%g2l(idxv,info,owned=owned)
|
||||
idx = idxv(1)
|
||||
|
||||
end subroutine repl_g2ls1
|
||||
|
||||
subroutine repl_g2ls2(idxin,idxout,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(in) :: idxmap
|
||||
integer, intent(in) :: idxin
|
||||
integer, intent(out) :: idxout
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
idxout = idxin
|
||||
call idxmap%g2l(idxout,info,mask,owned)
|
||||
|
||||
end subroutine repl_g2ls2
|
||||
|
||||
|
||||
subroutine repl_g2lv1(idx,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(in) :: idxmap
|
||||
integer, intent(inout) :: idx(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
integer :: i, nv, is
|
||||
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_asb()) then
|
||||
do i=1, is
|
||||
if (mask(i)) then
|
||||
if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then
|
||||
! do nothing
|
||||
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 ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then
|
||||
! do nothing
|
||||
|
||||
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_asb()) then
|
||||
do i=1, is
|
||||
if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then
|
||||
! do nothing
|
||||
else
|
||||
idx(i) = -1
|
||||
end if
|
||||
end do
|
||||
else if (idxmap%is_valid()) then
|
||||
do i=1,is
|
||||
if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then
|
||||
! do nothing
|
||||
else
|
||||
idx(i) = -1
|
||||
end if
|
||||
end do
|
||||
else
|
||||
idx(1:is) = -1
|
||||
info = -1
|
||||
end if
|
||||
|
||||
end if
|
||||
|
||||
end subroutine repl_g2lv1
|
||||
|
||||
subroutine repl_g2lv2(idxin,idxout,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(in) :: idxmap
|
||||
integer, intent(in) :: idxin(:)
|
||||
integer, intent(out) :: idxout(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
integer :: is, im
|
||||
|
||||
is = size(idxin)
|
||||
im = min(is,size(idxout))
|
||||
idxout(1:im) = idxin(1:im)
|
||||
call idxmap%g2l(idxout(1:im),info,mask,owned)
|
||||
if (is > im) info = -3
|
||||
|
||||
end subroutine repl_g2lv2
|
||||
|
||||
|
||||
|
||||
subroutine repl_g2ls1_ins(idx,idxmap,info,mask)
|
||||
use psb_realloc_mod
|
||||
use psb_sort_mod
|
||||
implicit none
|
||||
class(psb_repl_map), intent(inout) :: idxmap
|
||||
integer, intent(inout) :: idx
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
|
||||
integer :: idxv(1)
|
||||
|
||||
info = 0
|
||||
if (present(mask)) then
|
||||
if (.not.mask) return
|
||||
end if
|
||||
idxv(1) = idx
|
||||
call idxmap%g2l_ins(idxv,info)
|
||||
idx = idxv(1)
|
||||
|
||||
end subroutine repl_g2ls1_ins
|
||||
|
||||
subroutine repl_g2ls2_ins(idxin,idxout,idxmap,info,mask)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: idxin
|
||||
integer, intent(out) :: idxout
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
|
||||
idxout = idxin
|
||||
call idxmap%g2l_ins(idxout,info)
|
||||
|
||||
end subroutine repl_g2ls2_ins
|
||||
|
||||
|
||||
subroutine repl_g2lv1_ins(idx,idxmap,info,mask)
|
||||
use psb_realloc_mod
|
||||
use psb_sort_mod
|
||||
implicit none
|
||||
class(psb_repl_map), intent(inout) :: idxmap
|
||||
integer, intent(inout) :: idx(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
integer :: i, nv, is, ix
|
||||
|
||||
info = 0
|
||||
is = size(idx)
|
||||
|
||||
if (present(mask)) then
|
||||
if (size(mask) < 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(mask)) then
|
||||
do i=1, is
|
||||
if (mask(i)) then
|
||||
if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then
|
||||
! do nothing
|
||||
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
|
||||
! do nothing
|
||||
else
|
||||
idx(i) = -1
|
||||
end if
|
||||
end do
|
||||
end if
|
||||
|
||||
else
|
||||
idx = -1
|
||||
info = -1
|
||||
end if
|
||||
|
||||
end subroutine repl_g2lv1_ins
|
||||
|
||||
subroutine repl_g2lv2_ins(idxin,idxout,idxmap,info,mask)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: idxin(:)
|
||||
integer, intent(out) :: idxout(:)
|
||||
integer, intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
integer :: is, im
|
||||
|
||||
is = size(idxin)
|
||||
im = min(is,size(idxout))
|
||||
idxout(1:im) = idxin(1:im)
|
||||
call idxmap%g2l_ins(idxout(1:im),info,mask)
|
||||
if (is > im) info = -3
|
||||
|
||||
end subroutine repl_g2lv2_ins
|
||||
|
||||
|
||||
subroutine repl_fnd_owner(idx,iprc,idxmap,info)
|
||||
use psb_penv_mod
|
||||
implicit none
|
||||
integer, intent(in) :: idx(:)
|
||||
integer, allocatable, intent(out) :: iprc(:)
|
||||
class(psb_repl_map), intent(in) :: idxmap
|
||||
integer, intent(out) :: info
|
||||
integer :: ictxt, iam, np, nv
|
||||
|
||||
ictxt = idxmap%get_ctxt()
|
||||
call psb_info(ictxt,iam,np)
|
||||
|
||||
write(0,*) iam, ' REPL fnd_owner'
|
||||
nv = size(idx)
|
||||
allocate(iprc(nv),stat=info)
|
||||
if (info /= 0) then
|
||||
write(0,*) 'Memory allocation failure in repl_map_fnd-owner'
|
||||
return
|
||||
end if
|
||||
iprc(1:nv) = iam
|
||||
|
||||
end subroutine repl_fnd_owner
|
||||
|
||||
|
||||
subroutine repl_init(idxmap,ictxt,nl,info)
|
||||
use psb_penv_mod
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_repl_map), intent(inout) :: idxmap
|
||||
integer, intent(in) :: ictxt, nl
|
||||
integer, intent(out) :: info
|
||||
! To be implemented
|
||||
integer :: iam, np, i, j, ntot
|
||||
integer, allocatable :: vnl(:)
|
||||
|
||||
info = 0
|
||||
call psb_info(ictxt,iam,np)
|
||||
if (np < 0) then
|
||||
write(psb_err_unit,*) 'Invalid ictxt:',ictxt
|
||||
info = -1
|
||||
return
|
||||
end if
|
||||
|
||||
|
||||
idxmap%global_rows = nl
|
||||
idxmap%global_cols = nl
|
||||
idxmap%local_rows = nl
|
||||
idxmap%local_cols = nl
|
||||
idxmap%ictxt = ictxt
|
||||
idxmap%state = psb_desc_bld_
|
||||
call psb_get_mpicomm(ictxt,idxmap%mpic)
|
||||
call idxmap%set_state(psb_desc_bld_)
|
||||
|
||||
end subroutine repl_init
|
||||
|
||||
|
||||
subroutine repl_asb(idxmap,info)
|
||||
use psb_penv_mod
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_repl_map), intent(inout) :: idxmap
|
||||
integer, intent(out) :: info
|
||||
|
||||
integer :: ictxt, iam, np
|
||||
|
||||
info = 0
|
||||
ictxt = idxmap%get_ctxt()
|
||||
call psb_info(ictxt,iam,np)
|
||||
|
||||
call idxmap%set_state(psb_desc_asb_)
|
||||
|
||||
end subroutine repl_asb
|
||||
|
||||
subroutine repl_free(idxmap)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(inout) :: idxmap
|
||||
|
||||
call idxmap%psb_indx_map%free()
|
||||
|
||||
end subroutine repl_free
|
||||
|
||||
|
||||
function repl_get_fmt(idxmap) result(res)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(in) :: idxmap
|
||||
character(len=5) :: res
|
||||
res = 'REPL'
|
||||
end function repl_get_fmt
|
||||
|
||||
end module psb_repl_map_mod
|
@ -0,0 +1,143 @@
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.0
|
||||
!!$ (C) Copyright 2006, 2007, 2008, 2009, 2010
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
!!$
|
||||
!!$ Redistribution and use in source and binary forms, with or without
|
||||
!!$ modification, are permitted provided that the following conditions
|
||||
!!$ are met:
|
||||
!!$ 1. Redistributions of source code must retain the above copyright
|
||||
!!$ notice, this list of conditions and the following disclaimer.
|
||||
!!$ 2. Redistributions in binary form must reproduce the above copyright
|
||||
!!$ notice, this list of conditions, and the following disclaimer in the
|
||||
!!$ documentation and/or other materials provided with the distribution.
|
||||
!!$ 3. The name of the PSBLAS group or the names of its contributors may
|
||||
!!$ not be used to endorse or promote products derived from this
|
||||
!!$ software without specific written permission.
|
||||
!!$
|
||||
!!$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
!!$ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
!!$ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
!!$ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
!!$ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
!!$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
!!$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
!!$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
!!$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
!!$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
!!$ POSSIBILITY OF SUCH DAMAGE.
|
||||
!!$
|
||||
!!$
|
||||
!
|
||||
!
|
||||
!
|
||||
Subroutine psb_cd_switch_ovl_indxmap(desc,info)
|
||||
|
||||
use psb_sparse_mod, psb_protect_name => psb_cd_switch_ovl_indxmap
|
||||
use psi_mod
|
||||
|
||||
|
||||
Implicit None
|
||||
|
||||
! .. Array Arguments ..
|
||||
Type(psb_desc_type), Intent(inout) :: desc
|
||||
integer, intent(out) :: info
|
||||
|
||||
! .. Local Scalars ..
|
||||
Integer :: i, j, np, me, mglob, ictxt, n_row, n_col
|
||||
integer :: icomm, err_act
|
||||
|
||||
integer, allocatable :: vl(:)
|
||||
integer :: debug_level, debug_unit
|
||||
character(len=20) :: name, ch_err
|
||||
|
||||
name='cd_switch_ovl_indxmap'
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
|
||||
ictxt = psb_cd_get_context(desc)
|
||||
icomm = psb_cd_get_mpic(desc)
|
||||
Call psb_info(ictxt, me, np)
|
||||
|
||||
If (debug_level >= psb_debug_outer_) &
|
||||
& Write(debug_unit,*) me,' ',trim(name),&
|
||||
& ': start'
|
||||
|
||||
mglob = psb_cd_get_global_rows(desc)
|
||||
n_row = psb_cd_get_local_rows(desc)
|
||||
n_col = psb_cd_get_local_cols(desc)
|
||||
|
||||
Allocate(vl(n_col),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='Allocate')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
do i=1,n_col
|
||||
vl(i) = i
|
||||
end do
|
||||
call desc%indxmap%l2g(vl(1:n_col),info)
|
||||
|
||||
!!$ write(0,*) 'from l2g' ,info,n_row,n_Col
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_ai_,name,&
|
||||
& a_err='map%l2g',i_err=(/info,0,0,0,0/))
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call desc%indxmap%free()
|
||||
deallocate(desc%indxmap)
|
||||
|
||||
if (psb_cd_choose_large_state(ictxt,mglob)) then
|
||||
allocate(psb_hash_map :: desc%indxmap, stat=info)
|
||||
else
|
||||
allocate(psb_list_map :: desc%indxmap, stat=info)
|
||||
end if
|
||||
|
||||
!!$ write(0,*) 'from allocate indxmap' ,info
|
||||
if (info == psb_success_)&
|
||||
& call desc%indxmap%init(ictxt,vl(1:n_row),info)
|
||||
!!$ write(0,*) 'from indxmap%init' ,info
|
||||
if (info == psb_success_) call psb_cd_set_bld(desc,info)
|
||||
!!$ write(0,*) 'from cd_Set_bld' ,info
|
||||
!!$ write(0,*) 'into g2l_ins' ,info,vl(n_row+1:n_col)
|
||||
if (info == psb_success_) &
|
||||
& call desc%indxmap%g2l_ins(vl(n_row+1:n_col),info)
|
||||
!!$ write(0,*) 'from g2l_ins' ,info,vl(n_row+1:n_col)
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_ai_,name,&
|
||||
& a_err='allocate/init',i_err=(/info,0,0,0,0/))
|
||||
goto 9999
|
||||
end if
|
||||
if (n_row /= desc%indxmap%get_lr()) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ': Local rows mismatch ',n_row,&
|
||||
&desc%indxmap%get_lr(),desc%indxmap%get_fmt()
|
||||
end if
|
||||
|
||||
if (n_col /= desc%indxmap%get_lc()) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ': Local cols mismatch ',n_col,&
|
||||
&desc%indxmap%get_lc(),desc%indxmap%get_fmt()
|
||||
end if
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),&
|
||||
& ': end',desc%indxmap%get_fmt()
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error(ictxt)
|
||||
return
|
||||
end if
|
||||
Return
|
||||
|
||||
End Subroutine psb_cd_switch_ovl_indxmap
|
||||
|
@ -0,0 +1,199 @@
|
||||
subroutine psb_cdall(ictxt, desc, info,mg,ng,parts,vg,vl,flag,nl,repl, globalcheck)
|
||||
use psb_descriptor_type
|
||||
use psb_serial_mod
|
||||
use psb_const_mod
|
||||
use psb_error_mod
|
||||
use psb_penv_mod
|
||||
use psb_base_tools_mod, psb_protect_name => psb_cdall
|
||||
use psi_mod
|
||||
implicit None
|
||||
include 'parts.fh'
|
||||
Integer, intent(in) :: mg,ng,ictxt, vg(:), vl(:),nl
|
||||
integer, intent(in) :: flag
|
||||
logical, intent(in) :: repl, globalcheck
|
||||
integer, intent(out) :: info
|
||||
type(psb_desc_type), intent(out) :: desc
|
||||
|
||||
optional :: mg,ng,parts,vg,vl,flag,nl,repl, globalcheck
|
||||
|
||||
interface
|
||||
subroutine psb_cdals(m, n, parts, ictxt, desc, info)
|
||||
use psb_descriptor_type
|
||||
include 'parts.fh'
|
||||
Integer, intent(in) :: m,n,ictxt
|
||||
Type(psb_desc_type), intent(out) :: desc
|
||||
integer, intent(out) :: info
|
||||
end subroutine psb_cdals
|
||||
subroutine psb_cdalv(v, ictxt, desc, info, flag)
|
||||
use psb_descriptor_type
|
||||
Integer, intent(in) :: ictxt, v(:)
|
||||
integer, intent(in), optional :: flag
|
||||
integer, intent(out) :: info
|
||||
Type(psb_desc_type), intent(out) :: desc
|
||||
end subroutine psb_cdalv
|
||||
subroutine psb_cd_inloc(v, ictxt, desc, info, globalcheck)
|
||||
use psb_descriptor_type
|
||||
implicit None
|
||||
Integer, intent(in) :: ictxt, v(:)
|
||||
integer, intent(out) :: info
|
||||
type(psb_desc_type), intent(out) :: desc
|
||||
logical, intent(in), optional :: globalcheck
|
||||
end subroutine psb_cd_inloc
|
||||
subroutine psb_cdrep(m, ictxt, desc,info)
|
||||
use psb_descriptor_type
|
||||
Integer, intent(in) :: m,ictxt
|
||||
Type(psb_desc_type), intent(out) :: desc
|
||||
integer, intent(out) :: info
|
||||
end subroutine psb_cdrep
|
||||
end interface
|
||||
character(len=20) :: name
|
||||
integer :: err_act, n_, flag_, i, me, np, nlp, nnv, lr
|
||||
integer, allocatable :: itmpsz(:)
|
||||
|
||||
|
||||
|
||||
if (psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name = 'psb_cdall'
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
|
||||
if (count((/ present(vg),present(vl),&
|
||||
& present(parts),present(nl), present(repl) /)) /= 1) then
|
||||
info=psb_err_no_optional_arg_
|
||||
call psb_errpush(info,name,a_err=" vg, vl, parts, nl, repl")
|
||||
goto 999
|
||||
endif
|
||||
|
||||
desc%base_desc => null()
|
||||
if (allocated(desc%indxmap)) then
|
||||
write(0,*) 'Allocated on an intent(OUT) var?'
|
||||
end if
|
||||
|
||||
if (present(parts)) then
|
||||
|
||||
if (.not.present(mg)) then
|
||||
info=psb_err_no_optional_arg_
|
||||
call psb_errpush(info,name)
|
||||
goto 999
|
||||
end if
|
||||
if (present(ng)) then
|
||||
n_ = ng
|
||||
else
|
||||
n_ = mg
|
||||
endif
|
||||
call psb_cdals(mg, n_, parts, ictxt, desc, info)
|
||||
|
||||
else if (present(repl)) then
|
||||
|
||||
if (.not.present(mg)) then
|
||||
info=psb_err_no_optional_arg_
|
||||
call psb_errpush(info,name)
|
||||
goto 999
|
||||
end if
|
||||
if (.not.repl) then
|
||||
info=psb_err_no_optional_arg_
|
||||
call psb_errpush(info,name)
|
||||
goto 999
|
||||
end if
|
||||
|
||||
call psb_cdrep(mg, ictxt, desc, info)
|
||||
|
||||
|
||||
else if (present(vg)) then
|
||||
|
||||
if (present(flag)) then
|
||||
flag_=flag
|
||||
else
|
||||
flag_=0
|
||||
endif
|
||||
if (present(mg)) then
|
||||
nnv = min(mg,size(vg))
|
||||
else
|
||||
nnv = size(vg)
|
||||
end if
|
||||
|
||||
call psb_cdalv(vg(1:nnv), ictxt, desc, info, flag=flag_)
|
||||
|
||||
else if (present(vl)) then
|
||||
|
||||
if (present(nl)) then
|
||||
nnv = min(nl,size(vl))
|
||||
else
|
||||
nnv = size(vl)
|
||||
end if
|
||||
|
||||
call psb_cd_inloc(vl(1:nnv),ictxt,desc,info, globalcheck=globalcheck)
|
||||
|
||||
else if (present(nl)) then
|
||||
|
||||
allocate(desc%matrix_data(psb_mdata_size_))
|
||||
desc%matrix_data(psb_m_) = nl
|
||||
call psb_sum(ictxt,desc%matrix_data(psb_m_))
|
||||
desc%matrix_data(psb_n_) = desc%matrix_data(psb_m_)
|
||||
desc%matrix_data(psb_ctxt_) = ictxt
|
||||
call psb_get_mpicomm(ictxt,desc%matrix_data(psb_mpi_c_))
|
||||
|
||||
|
||||
|
||||
if (np == 1) then
|
||||
allocate(psb_repl_map :: desc%indxmap, stat=info)
|
||||
else
|
||||
allocate(psb_gen_block_map :: desc%indxmap, stat=info)
|
||||
end if
|
||||
if (info == psb_success_) then
|
||||
select type(aa => desc%indxmap)
|
||||
type is (psb_repl_map)
|
||||
call aa%repl_map_init(ictxt,nl,info)
|
||||
type is (psb_gen_block_map)
|
||||
call aa%gen_block_map_init(ictxt,nl,info)
|
||||
class default
|
||||
! This cannot happen
|
||||
info = psb_err_internal_error_
|
||||
goto 999
|
||||
end select
|
||||
end if
|
||||
|
||||
call psb_realloc(1,itmpsz, info)
|
||||
if (info /= 0) then
|
||||
write(0,*) 'Error reallocating itmspz'
|
||||
goto 999
|
||||
end if
|
||||
itmpsz(:) = -1
|
||||
call psi_bld_tmpovrl(itmpsz,desc,info)
|
||||
|
||||
endif
|
||||
|
||||
if (info /= psb_success_) goto 999
|
||||
|
||||
! Finish off
|
||||
lr = desc%indxmap%get_lr()
|
||||
call psb_realloc(max(1,lr/2),desc%halo_index, info)
|
||||
if (info == psb_success_) call psb_realloc(1,desc%ext_index, info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='psb_realloc')
|
||||
Goto 999
|
||||
end if
|
||||
desc%matrix_data(psb_pnt_h_) = 1
|
||||
desc%halo_index(:) = -1
|
||||
desc%ext_index(:) = -1
|
||||
call psb_cd_set_bld(desc,info)
|
||||
desc%matrix_data(psb_n_row_) = desc%indxmap%get_lr()
|
||||
desc%matrix_data(psb_n_col_) = desc%indxmap%get_lc()
|
||||
if (info /= psb_success_) goto 999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error(ictxt)
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
|
||||
end subroutine psb_cdall
|
Loading…
Reference in New Issue