mirror of
https://github.com/sfilippone/psblas3.git
synced 2026-10-20 12:52:14 +00:00
psblas3:
base/modules/Makefile base/modules/aux base/modules/aux/psb_c_sort_mod.f90 base/modules/aux/psb_d_sort_mod.f90 base/modules/aux/psb_hash_mod.f90 base/modules/aux/psb_i_sort_mod.f90 base/modules/aux/psb_ip_reord_mod.f90 base/modules/aux/psb_s_sort_mod.f90 base/modules/aux/psb_sort_mod.f90 base/modules/aux/psb_string_mod.f90 base/modules/aux/psb_z_sort_mod.f90 base/modules/aux/psi_c_serial_mod.f90 base/modules/aux/psi_d_serial_mod.f90 base/modules/aux/psi_i_serial_mod.f90 base/modules/aux/psi_s_serial_mod.f90 base/modules/aux/psi_serial_mod.f90 base/modules/aux/psi_z_serial_mod.f90 base/modules/comm base/modules/comm/psb_base_linmap_mod.f90 base/modules/comm/psb_c_comm_mod.f90 base/modules/comm/psb_c_linmap_mod.f90 base/modules/comm/psb_comm_mod.f90 base/modules/comm/psb_d_comm_mod.f90 base/modules/comm/psb_d_linmap_mod.f90 base/modules/comm/psb_i_comm_mod.f90 base/modules/comm/psb_linmap_mod.f90 base/modules/comm/psb_s_comm_mod.f90 base/modules/comm/psb_s_linmap_mod.f90 base/modules/comm/psb_z_comm_mod.f90 base/modules/comm/psb_z_linmap_mod.f90 base/modules/desc base/modules/desc/psb_desc_const_mod.f90 base/modules/desc/psb_desc_mod.F90 base/modules/desc/psb_gen_block_map_mod.f90 base/modules/desc/psb_glist_map_mod.f90 base/modules/desc/psb_hash_map_mod.f90 base/modules/desc/psb_indx_map_mod.f90 base/modules/desc/psb_list_map_mod.f90 base/modules/desc/psb_repl_map_mod.f90 base/modules/psb_base_linmap_mod.f90 base/modules/psb_base_mat_mod.f90 base/modules/psb_c_base_mat_mod.f90 base/modules/psb_c_base_vect_mod.f90 base/modules/psb_c_comm_mod.f90 base/modules/psb_c_csc_mat_mod.f90 base/modules/psb_c_csr_mat_mod.f90 base/modules/psb_c_linmap_mod.f90 base/modules/psb_c_mat_mod.f90 base/modules/psb_c_psblas_mod.F90 base/modules/psb_c_serial_mod.f90 base/modules/psb_c_sort_mod.f90 base/modules/psb_c_tools_mod.f90 base/modules/psb_c_vect_mod.F90 base/modules/psb_cd_tools_mod.f90 base/modules/psb_comm_mod.f90 base/modules/psb_d_base_mat_mod.f90 base/modules/psb_d_base_vect_mod.f90 base/modules/psb_d_comm_mod.f90 base/modules/psb_d_csc_mat_mod.f90 base/modules/psb_d_csr_mat_mod.f90 base/modules/psb_d_linmap_mod.f90 base/modules/psb_d_mat_mod.f90 base/modules/psb_d_psblas_mod.F90 base/modules/psb_d_serial_mod.f90 base/modules/psb_d_sort_mod.f90 base/modules/psb_d_tools_mod.f90 base/modules/psb_d_vect_mod.F90 base/modules/psb_desc_const_mod.f90 base/modules/psb_desc_mod.F90 base/modules/psb_gen_block_map_mod.f90 base/modules/psb_glist_map_mod.f90 base/modules/psb_hash_map_mod.f90 base/modules/psb_hash_mod.f90 base/modules/psb_i_base_vect_mod.f90 base/modules/psb_i_comm_mod.f90 base/modules/psb_i_sort_mod.f90 base/modules/psb_i_tools_mod.f90 base/modules/psb_i_vect_mod.F90 base/modules/psb_indx_map_mod.f90 base/modules/psb_ip_reord_mod.f90 base/modules/psb_linmap_mod.f90 base/modules/psb_list_map_mod.f90 base/modules/psb_mat_mod.f90 base/modules/psb_psblas_mod.f90 base/modules/psb_repl_map_mod.f90 base/modules/psb_s_base_mat_mod.f90 base/modules/psb_s_base_vect_mod.f90 base/modules/psb_s_comm_mod.f90 base/modules/psb_s_csc_mat_mod.f90 base/modules/psb_s_csr_mat_mod.f90 base/modules/psb_s_linmap_mod.f90 base/modules/psb_s_mat_mod.f90 base/modules/psb_s_psblas_mod.F90 base/modules/psb_s_serial_mod.f90 base/modules/psb_s_sort_mod.f90 base/modules/psb_s_tools_mod.f90 base/modules/psb_s_vect_mod.F90 base/modules/psb_serial_mod.f90 base/modules/psb_sort_mod.f90 base/modules/psb_sort_mod_save.f90 base/modules/psb_string_mod.f90 base/modules/psb_tools_mod.f90 base/modules/psb_vect_mod.f90 base/modules/psb_z_base_mat_mod.f90 base/modules/psb_z_base_vect_mod.f90 base/modules/psb_z_comm_mod.f90 base/modules/psb_z_csc_mat_mod.f90 base/modules/psb_z_csr_mat_mod.f90 base/modules/psb_z_linmap_mod.f90 base/modules/psb_z_mat_mod.f90 base/modules/psb_z_psblas_mod.F90 base/modules/psb_z_serial_mod.f90 base/modules/psb_z_sort_mod.f90 base/modules/psb_z_tools_mod.f90 base/modules/psb_z_vect_mod.F90 base/modules/psblas base/modules/psblas/psb_c_psblas_mod.F90 base/modules/psblas/psb_d_psblas_mod.F90 base/modules/psblas/psb_psblas_mod.f90 base/modules/psblas/psb_s_psblas_mod.F90 base/modules/psblas/psb_z_psblas_mod.F90 base/modules/psi_c_serial_mod.f90 base/modules/psi_d_serial_mod.f90 base/modules/psi_i_serial_mod.f90 base/modules/psi_s_serial_mod.f90 base/modules/psi_serial_mod.f90 base/modules/psi_z_serial_mod.f90 base/modules/serial base/modules/serial/psb_base_mat_mod.f90 base/modules/serial/psb_c_base_mat_mod.f90 base/modules/serial/psb_c_base_vect_mod.f90 base/modules/serial/psb_c_csc_mat_mod.f90 base/modules/serial/psb_c_csr_mat_mod.f90 base/modules/serial/psb_c_mat_mod.f90 base/modules/serial/psb_c_serial_mod.f90 base/modules/serial/psb_c_vect_mod.F90 base/modules/serial/psb_d_base_mat_mod.f90 base/modules/serial/psb_d_base_vect_mod.f90 base/modules/serial/psb_d_csc_mat_mod.f90 base/modules/serial/psb_d_csr_mat_mod.f90 base/modules/serial/psb_d_mat_mod.f90 base/modules/serial/psb_d_serial_mod.f90 base/modules/serial/psb_d_vect_mod.F90 base/modules/serial/psb_i_base_vect_mod.f90 base/modules/serial/psb_i_vect_mod.F90 base/modules/serial/psb_mat_mod.f90 base/modules/serial/psb_s_base_mat_mod.f90 base/modules/serial/psb_s_base_vect_mod.f90 base/modules/serial/psb_s_csc_mat_mod.f90 base/modules/serial/psb_s_csr_mat_mod.f90 base/modules/serial/psb_s_mat_mod.f90 base/modules/serial/psb_s_serial_mod.f90 base/modules/serial/psb_s_vect_mod.F90 base/modules/serial/psb_serial_mod.f90 base/modules/serial/psb_vect_mod.f90 base/modules/serial/psb_z_base_mat_mod.f90 base/modules/serial/psb_z_base_vect_mod.f90 base/modules/serial/psb_z_csc_mat_mod.f90 base/modules/serial/psb_z_csr_mat_mod.f90 base/modules/serial/psb_z_mat_mod.f90 base/modules/serial/psb_z_serial_mod.f90 base/modules/serial/psb_z_vect_mod.F90 base/modules/tools base/modules/tools/psb_c_tools_mod.f90 base/modules/tools/psb_cd_tools_mod.f90 base/modules/tools/psb_d_tools_mod.f90 base/modules/tools/psb_i_tools_mod.f90 base/modules/tools/psb_s_tools_mod.f90 base/modules/tools/psb_tools_mod.f90 base/modules/tools/psb_z_tools_mod.f90 configure.ac configure Mreged reorganization of the base/modules subdir from newdesc branch.
This commit is contained in:
@@ -0,0 +1,130 @@
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.4
|
||||
!!$ (C) Copyright 2006, 2010, 2015
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
!
|
||||
!
|
||||
! package: psb_desc_const_mod
|
||||
! Auxiliary module for descriptor: constant values.
|
||||
!
|
||||
module psb_desc_const_mod
|
||||
use psb_const_mod, only : psb_ipk_, psb_mpik_
|
||||
!
|
||||
! Communication, prolongation & restriction
|
||||
!
|
||||
integer(psb_ipk_), parameter :: psb_nohalo_=0, psb_halo_=1
|
||||
! For overlap update.
|
||||
integer(psb_ipk_), parameter :: psb_none_=0, psb_sum_=1
|
||||
integer(psb_ipk_), parameter :: psb_avg_=2, psb_square_root_=3
|
||||
integer(psb_ipk_), parameter :: psb_setzero_=4
|
||||
|
||||
! The following are bit fields.
|
||||
integer(psb_ipk_), parameter :: psb_swap_send_=1, psb_swap_recv_=2
|
||||
integer(psb_ipk_), parameter :: psb_swap_sync_=4, psb_swap_mpi_=8
|
||||
! Choice among lists on which to base data exchange
|
||||
integer(psb_ipk_), parameter :: psb_no_comm_=-1
|
||||
integer(psb_ipk_), parameter :: psb_comm_halo_=1, psb_comm_ovr_=2
|
||||
integer(psb_ipk_), parameter :: psb_comm_ext_=3, psb_comm_mov_=4
|
||||
! Types of mapping between descriptors.
|
||||
integer(psb_ipk_), parameter :: psb_map_xhal_ = 123
|
||||
integer(psb_ipk_), parameter :: psb_map_asov_ = psb_map_xhal_+1
|
||||
integer(psb_ipk_), parameter :: psb_map_aggr_ = psb_map_asov_+1
|
||||
integer(psb_ipk_), parameter :: psb_map_gen_linear_ = psb_map_aggr_+1
|
||||
|
||||
integer(psb_ipk_), parameter :: psb_ovt_xhal_ = psb_map_xhal_, psb_ovt_asov_=psb_map_asov_
|
||||
!
|
||||
! Entries and values in desc%matrix_data
|
||||
!
|
||||
integer(psb_ipk_), parameter :: psb_dec_type_ = 1
|
||||
integer(psb_ipk_), parameter :: psb_m_ = 2
|
||||
integer(psb_ipk_), parameter :: psb_n_ = 3
|
||||
integer(psb_ipk_), parameter :: psb_n_row_ = 4
|
||||
integer(psb_ipk_), parameter :: psb_n_col_ = 5
|
||||
integer(psb_ipk_), parameter :: psb_ctxt_ = 6
|
||||
integer(psb_ipk_), parameter :: psb_desc_size_ = 7
|
||||
integer(psb_ipk_), parameter :: psb_mpi_c_ = 9
|
||||
integer(psb_ipk_), parameter :: psb_pnt_h_ = 10
|
||||
integer(psb_ipk_), parameter :: psb_thal_xch_ = 11
|
||||
integer(psb_ipk_), parameter :: psb_thal_snd_ = 12
|
||||
integer(psb_ipk_), parameter :: psb_thal_rcv_ = 13
|
||||
integer(psb_ipk_), parameter :: psb_tovr_xch_ = 14
|
||||
integer(psb_ipk_), parameter :: psb_tovr_snd_ = 15
|
||||
integer(psb_ipk_), parameter :: psb_tovr_rcv_ = 16
|
||||
integer(psb_ipk_), parameter :: psb_text_xch_ = 17
|
||||
integer(psb_ipk_), parameter :: psb_text_snd_ = 18
|
||||
integer(psb_ipk_), parameter :: psb_text_rcv_ = 19
|
||||
integer(psb_ipk_), parameter :: psb_tmov_xch_ = 20
|
||||
integer(psb_ipk_), parameter :: psb_tmov_snd_ = 21
|
||||
integer(psb_ipk_), parameter :: psb_tmov_rcv_ = 22
|
||||
integer(psb_ipk_), parameter :: psb_mdata_size_= 24
|
||||
integer(psb_ipk_), parameter :: psb_desc_invalid_=-1
|
||||
integer(psb_ipk_), parameter :: psb_desc_null_=-1
|
||||
integer(psb_ipk_), parameter :: psb_desc_asb_=3099
|
||||
integer(psb_ipk_), parameter :: psb_desc_bld_=psb_desc_asb_+1
|
||||
integer(psb_ipk_), parameter :: psb_desc_upd_=psb_desc_bld_+1
|
||||
integer(psb_ipk_), parameter :: psb_desc_repl_=3199
|
||||
integer(psb_ipk_), parameter :: psb_desc_ovl_bld_=3399
|
||||
integer(psb_ipk_), parameter :: psb_desc_ovl_asb_=psb_desc_ovl_bld_+1
|
||||
! these two are reserved for descriptors which are
|
||||
! "overlap-extensions" of base descriptors.
|
||||
integer(psb_ipk_), parameter :: psb_cd_ovl_bld_=psb_desc_ovl_bld_
|
||||
integer(psb_ipk_), parameter :: psb_cd_ovl_asb_=psb_desc_ovl_asb_
|
||||
integer(psb_ipk_), parameter :: psb_desc_normal_=3299
|
||||
integer(psb_ipk_), parameter :: psb_desc_large_=psb_desc_normal_+1
|
||||
!
|
||||
! Constants for hashing into desc%hashv(:) and desc%glb_lc(:,:)
|
||||
!
|
||||
integer(psb_ipk_), parameter :: psb_hash_bits=16
|
||||
integer(psb_ipk_), parameter :: psb_max_hash_bits=22
|
||||
integer(psb_ipk_), parameter :: psb_hash_size=2**psb_hash_bits, psb_hash_mask=psb_hash_size-1
|
||||
integer(psb_ipk_), parameter :: psb_default_large_threshold=1*1024*1024
|
||||
integer(psb_ipk_), parameter :: psb_hpnt_nentries_=7
|
||||
|
||||
!
|
||||
! Constants for desc_a handling
|
||||
!
|
||||
|
||||
integer(psb_ipk_), parameter :: psb_upd_glbnum_=998
|
||||
integer(psb_ipk_), parameter :: psb_upd_locnum_=997
|
||||
integer(psb_ipk_), parameter :: psb_proc_id_=0, psb_n_elem_recv_=1
|
||||
integer(psb_ipk_), parameter :: psb_elem_recv_=2, psb_n_elem_send_=2
|
||||
integer(psb_ipk_), parameter :: psb_elem_send_=3, psb_n_ovrlp_elem_=1
|
||||
integer(psb_ipk_), parameter :: psb_ovrlp_elem_to_=2, psb_ovrlp_elem_=0
|
||||
integer(psb_ipk_), parameter :: psb_n_dom_ovr_=1
|
||||
|
||||
interface
|
||||
subroutine psb_parts(glob_index,nrow,np,pv,nv)
|
||||
import :: psb_ipk_
|
||||
integer(psb_ipk_), intent (in) :: glob_index,nrow, np
|
||||
integer(psb_ipk_), intent (out) :: nv, pv(*)
|
||||
end subroutine psb_parts
|
||||
end interface
|
||||
|
||||
end module psb_desc_const_mod
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,250 @@
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.4
|
||||
!!$ (C) Copyright 2006, 2010, 2015
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
!
|
||||
!
|
||||
! package: psb_glist_map_mod
|
||||
! Defines the GLIST_MAP type.
|
||||
!
|
||||
! This is almost identical to the LIST_MAP type, but it has an additional
|
||||
! vector of size GLOB_ROWS giving, for each index, the owning process.
|
||||
! This implies that:
|
||||
! 1. We have room for such an additional vector;
|
||||
! 2. There are no overlap (only one process owns a given index).
|
||||
!
|
||||
!
|
||||
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(psb_ipk_), 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) :: clone => glist_clone
|
||||
procedure, nopass :: 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(psb_mpik_), intent(in) :: ictxt
|
||||
integer(psb_ipk_), intent(in) :: vg(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! To be implemented
|
||||
integer(psb_mpik_) :: iam, np
|
||||
integer(psb_ipk_) :: i, 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(psb_ipk_), intent(in) :: idx(:)
|
||||
integer(psb_ipk_), allocatable, intent(out) :: iprc(:)
|
||||
class(psb_glist_map), intent(in) :: idxmap
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_mpik_) :: ictxt, iam, np
|
||||
integer(psb_ipk_) :: nv, 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() result(res)
|
||||
implicit none
|
||||
character(len=5) :: res
|
||||
res = 'GLIST'
|
||||
end function glist_get_fmt
|
||||
|
||||
|
||||
|
||||
subroutine glist_clone(idxmap,outmap,info)
|
||||
use psb_penv_mod
|
||||
use psb_error_mod
|
||||
use psb_realloc_mod
|
||||
implicit none
|
||||
class(psb_glist_map), intent(inout) :: idxmap
|
||||
class(psb_indx_map), allocatable, intent(out) :: outmap
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='glist_clone'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
info = psb_success_
|
||||
call psb_get_erraction(err_act)
|
||||
if (allocated(outmap)) then
|
||||
write(0,*) 'Error: should not be allocated on input'
|
||||
info = -87
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
allocate(psb_glist_map :: outmap, stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
select type (outmap)
|
||||
type is (psb_glist_map)
|
||||
|
||||
if (info == psb_success_) then
|
||||
outmap%psb_indx_map = idxmap%psb_indx_map
|
||||
outmap%pnt_h = idxmap%pnt_h
|
||||
end if
|
||||
if (info == psb_success_)&
|
||||
& call psb_safe_ab_cpy(idxmap%loc_to_glob,outmap%loc_to_glob,info)
|
||||
if (info == psb_success_)&
|
||||
& call psb_safe_ab_cpy(idxmap%glob_to_loc,outmap%glob_to_loc,info)
|
||||
if (info == psb_success_)&
|
||||
& call psb_safe_ab_cpy(idxmap%vgp,outmap%vgp,info)
|
||||
class default
|
||||
! This should be impossible
|
||||
info = -1
|
||||
end select
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_from_subroutine_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine glist_clone
|
||||
|
||||
end module psb_glist_map_mod
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,877 @@
|
||||
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.4
|
||||
!!$ (C) Copyright 2006, 2010, 2015
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
!
|
||||
!
|
||||
! package: psb_indx_map_mod
|
||||
! Defines the PSB_INDX_MAP class.
|
||||
!
|
||||
!
|
||||
!
|
||||
module psb_indx_map_mod
|
||||
use psb_const_mod
|
||||
use psb_desc_const_mod
|
||||
|
||||
!
|
||||
!> \namespace psb_base_mod \class psb_indx_map
|
||||
!! \brief Object to handle the mapping between global and local indices.
|
||||
!!
|
||||
!!
|
||||
!! In particular, besides the communicator, it contains the data relevant
|
||||
!! to the following queries:
|
||||
!!
|
||||
!! - How many global rows/columns?
|
||||
!!
|
||||
!! - How many local rows/columns?
|
||||
!!
|
||||
!! - Convert between local and global indices
|
||||
!!
|
||||
!! - Add to local indices.
|
||||
!!
|
||||
!! - Find (one of) the owner(s) of a given index
|
||||
!!
|
||||
!! - Query the indx state.
|
||||
!!
|
||||
!! - Does the dynamic class support extensions of the rows? I.e., can
|
||||
!! it have overlap? for instance, the BLOCK cannot, it would run afoul
|
||||
!! of the glob_to_loc translation.
|
||||
!!
|
||||
!! Checking for the existence of overlap is very expensive, thus
|
||||
!! it is done at build time (for extended-halo cases it can be inferred from
|
||||
!! the construction process).
|
||||
!!
|
||||
!! The object can be in the NULL, BUILD or ASSEMBLED state.
|
||||
!!
|
||||
!! Rules/constraints:
|
||||
!!
|
||||
!! 1. Each global index I is owned by at least one process;
|
||||
!!
|
||||
!! 2. On each process, indices from 1 to N_ROW (desc%indxmap%get_lr())
|
||||
!! are locally owned; the value of N_ROW can be determined upon allocation
|
||||
!! based on the index distribution (see also the interface to CDALL).
|
||||
!!
|
||||
!! 3. If a global index is owned by more than one process, we have an OVERLAP
|
||||
!! in which case the sum of all the N_ROW values is greater than the total
|
||||
!! size of the index space;
|
||||
!!
|
||||
!! 4. During the buildup of the descriptor, according to the user specified
|
||||
!! stencil, we also take notice of indices that are not owned by the current
|
||||
!! process, but whose value is needed to proceed with the computation; these
|
||||
!! form the HALO of the current process. Halo indices are assigned local indices
|
||||
!! from N_ROW+1 to N_COL (inclusive).
|
||||
!!
|
||||
!! 5. The upper bound N_COL moves during the descriptor build process (see CDINS).
|
||||
!!
|
||||
!!
|
||||
!! This is the base version of the class; as such, it only contains
|
||||
!! methods for getting/setting the common attributes, whereas
|
||||
!! the index translation methods are only implemented at the derived
|
||||
!! class level.
|
||||
!! Note that the INIT method is defined in the derived methods, and
|
||||
!! is specialized for them; a better solution would have to have
|
||||
!! a constructor for each specific class, with the name of the class,
|
||||
!! but this is not yet working on many compilers, most notably GNU.
|
||||
!!
|
||||
!! Note: the CLONE method was implemented as a workaround for a problem
|
||||
!! with SOURCE= allocation on GNU. Might be removed later on.
|
||||
!!
|
||||
type :: psb_indx_map
|
||||
!> State of the map
|
||||
integer(psb_ipk_) :: state = psb_desc_null_
|
||||
!> Communication context
|
||||
integer(psb_mpik_) :: ictxt = -1
|
||||
!> MPI communicator
|
||||
integer(psb_mpik_) :: mpic = -1
|
||||
!> Number of global rows
|
||||
integer(psb_ipk_) :: global_rows = -1
|
||||
!> Number of global columns
|
||||
integer(psb_ipk_) :: global_cols = -1
|
||||
!> Number of local rows
|
||||
integer(psb_ipk_) :: local_rows = -1
|
||||
!> Number of local columns
|
||||
integer(psb_ipk_) :: local_cols = -1
|
||||
!> A pointer to the user-defined parts subroutine
|
||||
procedure(psb_parts), nopass, pointer :: parts => null()
|
||||
!> The global vector assigning indices to processes, temp copy
|
||||
integer(psb_ipk_), allocatable :: tempvg(:)
|
||||
!> Reserved for future use.
|
||||
integer(psb_ipk_), allocatable :: oracle(:,:)
|
||||
|
||||
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, nopass :: 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, nopass :: 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, nopass :: get_fmt => base_get_fmt
|
||||
|
||||
procedure, pass(idxmap) :: asb => base_asb
|
||||
procedure, pass(idxmap) :: free => base_free
|
||||
procedure, pass(idxmap) :: clone => base_clone
|
||||
procedure, pass(idxmap) :: reinit => base_reinit
|
||||
|
||||
procedure, pass(idxmap) :: l2gs1 => base_l2gs1
|
||||
procedure, pass(idxmap) :: l2gs2 => base_l2gs2
|
||||
procedure, pass(idxmap) :: l2gv1 => base_l2gv1
|
||||
procedure, pass(idxmap) :: l2gv2 => base_l2gv2
|
||||
generic, public :: l2g => l2gs2, l2gv2
|
||||
generic, public :: l2gip => l2gs1, l2gv1
|
||||
|
||||
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 => g2ls2, g2lv2
|
||||
generic, public :: g2lip => g2ls1, g2lv1
|
||||
|
||||
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 => g2ls2_ins, g2lv2_ins
|
||||
generic, public :: g2lip_ins => g2ls1_ins, g2lv1_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, base_clone, base_reinit
|
||||
|
||||
!> Function: psb_indx_map_fnd_owner
|
||||
!! \memberof psb_indx_map
|
||||
!! \brief Find the process owning indices
|
||||
!!
|
||||
!! Given a list of indices IDX, return the processes owning
|
||||
!! them. The base class provides the default implementation,
|
||||
!! which is simply aggregating the requests and converting on
|
||||
!! each proces who then builds its part of the solution.
|
||||
!! This implies that in general this routine is a
|
||||
!! synchronization point; for some derived classes it is
|
||||
!! possible to answer locally, but this should not be relied
|
||||
!! upon.
|
||||
!!
|
||||
!! \param idx(:) The set of indices (local to each process)
|
||||
!! \param iprc(:) The processes owning them
|
||||
!! \param info return code.
|
||||
!!
|
||||
|
||||
interface
|
||||
subroutine psb_indx_map_fnd_owner(idx,iprc,idxmap,info)
|
||||
import :: psb_indx_map, psb_ipk_
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: idx(:)
|
||||
integer(psb_ipk_), allocatable, intent(out) :: iprc(:)
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine psb_indx_map_fnd_owner
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
|
||||
!>
|
||||
!! \memberof psb_indx_map
|
||||
!! \brief Print a descriptive name
|
||||
function base_get_fmt() result(res)
|
||||
implicit none
|
||||
character(len=5) :: res
|
||||
res = 'NULL'
|
||||
end function base_get_fmt
|
||||
|
||||
|
||||
function base_get_state(idxmap) result(val)
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer(psb_ipk_) :: 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(psb_ipk_) :: 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(psb_ipk_) :: 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(psb_ipk_) :: 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(psb_ipk_) :: 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(psb_mpik_) :: 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(psb_mpik_) :: 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(psb_ipk_), 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(psb_mpik_), 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(psb_ipk_), 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(psb_ipk_), 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(psb_ipk_), 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(psb_ipk_), 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(psb_mpik_), intent(in) :: val
|
||||
|
||||
idxmap%mpic = val
|
||||
end subroutine base_set_mpic
|
||||
|
||||
|
||||
!>
|
||||
!! \memberof psb_indx_map
|
||||
!! \brief Is the class capable of having overlapped rows?
|
||||
function base_row_extendable() result(val)
|
||||
implicit none
|
||||
logical :: val
|
||||
val = .false.
|
||||
end function base_row_extendable
|
||||
|
||||
function base_is_repl() result(val)
|
||||
implicit none
|
||||
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
|
||||
|
||||
|
||||
!>
|
||||
!! \memberof psb_indx_map
|
||||
!! \brief Local to global, scalar, in place
|
||||
subroutine base_l2gs1(idx,idxmap,info,mask,owned)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(in) :: idxmap
|
||||
integer(psb_ipk_), intent(inout) :: idx
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
integer(psb_ipk_) :: 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())
|
||||
|
||||
call psb_error_handler(err_act)
|
||||
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(psb_ipk_), intent(in) :: idxin
|
||||
integer(psb_ipk_), intent(out) :: idxout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
integer(psb_ipk_) :: 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())
|
||||
|
||||
call psb_error_handler(err_act)
|
||||
|
||||
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(psb_ipk_), intent(inout) :: idx(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
integer(psb_ipk_) :: 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())
|
||||
|
||||
call psb_error_handler(err_act)
|
||||
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(psb_ipk_), intent(in) :: idxin(:)
|
||||
integer(psb_ipk_), intent(out) :: idxout(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
integer(psb_ipk_) :: 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())
|
||||
|
||||
call psb_error_handler(err_act)
|
||||
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(psb_ipk_), intent(inout) :: idx
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
integer(psb_ipk_) :: 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())
|
||||
|
||||
call psb_error_handler(err_act)
|
||||
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(psb_ipk_), intent(in) :: idxin
|
||||
integer(psb_ipk_), intent(out) :: idxout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
integer(psb_ipk_) :: 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())
|
||||
|
||||
call psb_error_handler(err_act)
|
||||
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(psb_ipk_), intent(inout) :: idx(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
integer(psb_ipk_) :: 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())
|
||||
|
||||
call psb_error_handler(err_act)
|
||||
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(psb_ipk_), intent(in) :: idxin(:)
|
||||
integer(psb_ipk_), intent(out) :: idxout(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
integer(psb_ipk_) :: 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())
|
||||
|
||||
call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
|
||||
end subroutine base_g2lv2
|
||||
|
||||
|
||||
|
||||
subroutine base_g2ls1_ins(idx,idxmap,info,mask, lidx)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
integer(psb_ipk_), intent(inout) :: idx
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
integer(psb_ipk_), intent(in), optional :: lidx
|
||||
integer(psb_ipk_) :: 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())
|
||||
|
||||
call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine base_g2ls1_ins
|
||||
|
||||
subroutine base_g2ls2_ins(idxin,idxout,idxmap,info,mask, lidx)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
integer(psb_ipk_), intent(in) :: idxin
|
||||
integer(psb_ipk_), intent(out) :: idxout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
integer(psb_ipk_), intent(in), optional :: lidx
|
||||
|
||||
integer(psb_ipk_) :: 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())
|
||||
|
||||
call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine base_g2ls2_ins
|
||||
|
||||
|
||||
subroutine base_g2lv1_ins(idx,idxmap,info,mask, lidx)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
integer(psb_ipk_), intent(inout) :: idx(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
integer(psb_ipk_), intent(in), optional :: lidx(:)
|
||||
|
||||
integer(psb_ipk_) :: 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())
|
||||
|
||||
call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine base_g2lv1_ins
|
||||
|
||||
subroutine base_g2lv2_ins(idxin,idxout,idxmap,info,mask,lidx)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
integer(psb_ipk_), intent(in) :: idxin(:)
|
||||
integer(psb_ipk_), intent(out) :: idxout(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
integer(psb_ipk_), intent(in), optional :: lidx(:)
|
||||
|
||||
integer(psb_ipk_) :: 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())
|
||||
|
||||
call psb_error_handler(err_act)
|
||||
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(psb_ipk_), intent(out) :: info
|
||||
|
||||
integer(psb_ipk_) :: 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())
|
||||
|
||||
call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine base_asb
|
||||
|
||||
subroutine base_free(idxmap)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
|
||||
! 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
|
||||
|
||||
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(psb_mpik_), intent(in) :: ictxt
|
||||
integer(psb_ipk_), intent(in) :: vl(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: 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())
|
||||
|
||||
call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine base_init_vl
|
||||
|
||||
subroutine base_clone(idxmap,outmap,info)
|
||||
use psb_penv_mod
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
class(psb_indx_map), allocatable, intent(out) :: outmap
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='base_clone'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
info = psb_success_
|
||||
|
||||
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())
|
||||
|
||||
call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine base_clone
|
||||
|
||||
|
||||
subroutine base_reinit(idxmap,info)
|
||||
use psb_penv_mod
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_indx_map), intent(inout) :: idxmap
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='base_reinit'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
info = psb_success_
|
||||
|
||||
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())
|
||||
|
||||
call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine base_reinit
|
||||
|
||||
end module psb_indx_map_mod
|
||||
@@ -0,0 +1,728 @@
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.4
|
||||
!!$ (C) Copyright 2006, 2010, 2015
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
!
|
||||
!
|
||||
! package: psb_list_map_mod
|
||||
! Defines the LIST_MAP type.
|
||||
!
|
||||
! This is essentially the original PSBLAS index map. We assume that
|
||||
! 1. We have room for GLOB_TO_LOC and LOC_TO_GLOB
|
||||
! 2. There could be an overlap, so we don't store explicitly who owns an index.
|
||||
!
|
||||
!
|
||||
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(psb_ipk_) :: pnt_h = -1
|
||||
integer(psb_ipk_), 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) :: clone => list_clone
|
||||
procedure, pass(idxmap) :: reinit => list_reinit
|
||||
procedure, nopass :: get_fmt => list_get_fmt
|
||||
procedure, nopass :: row_extendable => list_row_extendable
|
||||
|
||||
procedure, pass(idxmap) :: l2gs1 => list_l2gs1
|
||||
procedure, pass(idxmap) :: l2gs2 => list_l2gs2
|
||||
procedure, pass(idxmap) :: l2gv1 => list_l2gv1
|
||||
procedure, pass(idxmap) :: l2gv2 => list_l2gv2
|
||||
|
||||
procedure, pass(idxmap) :: 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
|
||||
|
||||
integer(psb_ipk_), private :: laddsz=500
|
||||
|
||||
contains
|
||||
|
||||
function list_row_extendable() result(val)
|
||||
implicit none
|
||||
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(psb_ipk_), intent(inout) :: idx
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
integer(psb_ipk_) :: idxv(1)
|
||||
info = 0
|
||||
if (present(mask)) then
|
||||
if (.not.mask) return
|
||||
end if
|
||||
|
||||
idxv(1) = idx
|
||||
call idxmap%l2gip(idxv,info,owned=owned)
|
||||
idx = idxv(1)
|
||||
|
||||
end subroutine list_l2gs1
|
||||
|
||||
subroutine list_l2gs2(idxin,idxout,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_list_map), intent(in) :: idxmap
|
||||
integer(psb_ipk_), intent(in) :: idxin
|
||||
integer(psb_ipk_), intent(out) :: idxout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
idxout = idxin
|
||||
call idxmap%l2gip(idxout,info,mask,owned)
|
||||
|
||||
end subroutine list_l2gs2
|
||||
|
||||
|
||||
subroutine list_l2gv1(idx,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_list_map), intent(in) :: idxmap
|
||||
integer(psb_ipk_), intent(inout) :: idx(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
integer(psb_ipk_) :: i
|
||||
logical :: owned_
|
||||
info = 0
|
||||
|
||||
if (present(mask)) then
|
||||
if (size(mask) < size(idx)) then
|
||||
info = -1
|
||||
return
|
||||
end if
|
||||
end if
|
||||
if (present(owned)) then
|
||||
owned_ = owned
|
||||
else
|
||||
owned_ = .false.
|
||||
end if
|
||||
|
||||
if (present(mask)) then
|
||||
|
||||
do i=1, size(idx)
|
||||
if (mask(i)) then
|
||||
if ((1<=idx(i)).and.(idx(i) <= idxmap%get_lr())) then
|
||||
idx(i) = idxmap%loc_to_glob(idx(i))
|
||||
else if ((idxmap%get_lr() < idx(i)).and.(idx(i) <= idxmap%local_cols)&
|
||||
& .and.(.not.owned_)) then
|
||||
idx(i) = idxmap%loc_to_glob(idx(i))
|
||||
else
|
||||
idx(i) = -1
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
|
||||
else if (.not.present(mask)) then
|
||||
|
||||
do i=1, size(idx)
|
||||
if ((1<=idx(i)).and.(idx(i) <= idxmap%get_lr())) then
|
||||
idx(i) = idxmap%loc_to_glob(idx(i))
|
||||
else if ((idxmap%get_lr() < idx(i)).and.(idx(i) <= idxmap%local_cols)&
|
||||
& .and.(.not.owned_)) then
|
||||
idx(i) = idxmap%loc_to_glob(idx(i))
|
||||
else
|
||||
idx(i) = -1
|
||||
end if
|
||||
end do
|
||||
|
||||
end if
|
||||
|
||||
end subroutine list_l2gv1
|
||||
|
||||
subroutine list_l2gv2(idxin,idxout,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_list_map), intent(in) :: idxmap
|
||||
integer(psb_ipk_), intent(in) :: idxin(:)
|
||||
integer(psb_ipk_), intent(out) :: idxout(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
integer(psb_ipk_) :: is, im
|
||||
|
||||
is = size(idxin)
|
||||
im = min(is,size(idxout))
|
||||
idxout(1:im) = idxin(1:im)
|
||||
call idxmap%l2gip(idxout(1:im),info,mask,owned)
|
||||
if (is > im) info = -3
|
||||
|
||||
end subroutine list_l2gv2
|
||||
|
||||
|
||||
subroutine list_g2ls1(idx,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_list_map), intent(in) :: idxmap
|
||||
integer(psb_ipk_), intent(inout) :: idx
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
integer(psb_ipk_) :: idxv(1)
|
||||
info = 0
|
||||
|
||||
if (present(mask)) then
|
||||
if (.not.mask) return
|
||||
end if
|
||||
|
||||
idxv(1) = idx
|
||||
call idxmap%g2lip(idxv,info,owned=owned)
|
||||
idx = idxv(1)
|
||||
|
||||
end subroutine list_g2ls1
|
||||
|
||||
subroutine list_g2ls2(idxin,idxout,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_list_map), intent(in) :: idxmap
|
||||
integer(psb_ipk_), intent(in) :: idxin
|
||||
integer(psb_ipk_), intent(out) :: idxout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
idxout = idxin
|
||||
call idxmap%g2lip(idxout,info,mask,owned)
|
||||
|
||||
end subroutine list_g2ls2
|
||||
|
||||
|
||||
subroutine list_g2lv1(idx,idxmap,info,mask,owned)
|
||||
use psb_sort_mod
|
||||
implicit none
|
||||
class(psb_list_map), intent(in) :: idxmap
|
||||
integer(psb_ipk_), intent(inout) :: idx(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
integer(psb_ipk_) :: i, is, ix
|
||||
logical :: owned_
|
||||
|
||||
info = 0
|
||||
|
||||
if (present(mask)) then
|
||||
if (size(mask) < size(idx)) then
|
||||
info = -1
|
||||
return
|
||||
end if
|
||||
end if
|
||||
if (present(owned)) then
|
||||
owned_ = owned
|
||||
else
|
||||
owned_ = .false.
|
||||
end if
|
||||
|
||||
is = size(idx)
|
||||
|
||||
if (present(mask)) then
|
||||
if (idxmap%is_valid()) then
|
||||
do i=1,is
|
||||
if (mask(i)) then
|
||||
if ((1 <= idx(i)).and.(idx(i) <= idxmap%global_rows)) then
|
||||
ix = idxmap%glob_to_loc(idx(i))
|
||||
if ((ix > idxmap%get_lr()).and.(owned_)) ix = -1
|
||||
idx(i) = ix
|
||||
else
|
||||
idx(i) = -1
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
else
|
||||
idx(1:is) = -1
|
||||
info = -1
|
||||
end if
|
||||
|
||||
else if (.not.present(mask)) then
|
||||
|
||||
if (idxmap%is_valid()) then
|
||||
do i=1, is
|
||||
if ((1 <= idx(i)).and.(idx(i) <= idxmap%global_rows)) then
|
||||
ix = idxmap%glob_to_loc(idx(i))
|
||||
if ((ix > idxmap%get_lr()).and.(owned_)) ix = -1
|
||||
idx(i) = ix
|
||||
else
|
||||
idx(i) = -1
|
||||
end if
|
||||
end do
|
||||
else
|
||||
idx(1:is) = -1
|
||||
info = -1
|
||||
end if
|
||||
|
||||
end if
|
||||
|
||||
end subroutine list_g2lv1
|
||||
|
||||
subroutine list_g2lv2(idxin,idxout,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_list_map), intent(in) :: idxmap
|
||||
integer(psb_ipk_), intent(in) :: idxin(:)
|
||||
integer(psb_ipk_), intent(out) :: idxout(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
integer(psb_ipk_) :: is, im
|
||||
|
||||
is = size(idxin)
|
||||
im = min(is,size(idxout))
|
||||
idxout(1:im) = idxin(1:im)
|
||||
call idxmap%g2lip(idxout(1:im),info,mask,owned)
|
||||
if (is > im) info = -3
|
||||
|
||||
end subroutine list_g2lv2
|
||||
|
||||
|
||||
|
||||
subroutine list_g2ls1_ins(idx,idxmap,info,mask,lidx)
|
||||
use psb_realloc_mod
|
||||
use psb_sort_mod
|
||||
implicit none
|
||||
class(psb_list_map), intent(inout) :: idxmap
|
||||
integer(psb_ipk_), intent(inout) :: idx
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
integer(psb_ipk_), intent(in), optional :: lidx
|
||||
|
||||
integer(psb_ipk_) :: idxv(1), lidxv(1)
|
||||
|
||||
info = 0
|
||||
if (present(mask)) then
|
||||
if (.not.mask) return
|
||||
end if
|
||||
idxv(1) = idx
|
||||
if (present(lidx)) then
|
||||
lidxv(1) = lidx
|
||||
call idxmap%g2lip_ins(idxv,info,lidx=lidxv)
|
||||
else
|
||||
call idxmap%g2lip_ins(idxv,info)
|
||||
end if
|
||||
|
||||
idx = idxv(1)
|
||||
|
||||
end subroutine list_g2ls1_ins
|
||||
|
||||
subroutine list_g2ls2_ins(idxin,idxout,idxmap,info,mask,lidx)
|
||||
implicit none
|
||||
class(psb_list_map), intent(inout) :: idxmap
|
||||
integer(psb_ipk_), intent(in) :: idxin
|
||||
integer(psb_ipk_), intent(out) :: idxout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
integer(psb_ipk_), intent(in), optional :: lidx
|
||||
|
||||
idxout = idxin
|
||||
call idxmap%g2lip_ins(idxout,info,mask=mask,lidx=lidx)
|
||||
|
||||
end subroutine list_g2ls2_ins
|
||||
|
||||
|
||||
subroutine list_g2lv1_ins(idx,idxmap,info,mask,lidx)
|
||||
use psb_realloc_mod
|
||||
use psb_sort_mod
|
||||
implicit none
|
||||
class(psb_list_map), intent(inout) :: idxmap
|
||||
integer(psb_ipk_), intent(inout) :: idx(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
integer(psb_ipk_), intent(in), optional :: lidx(:)
|
||||
|
||||
integer(psb_ipk_) :: i, is, ix, lix
|
||||
|
||||
info = 0
|
||||
is = size(idx)
|
||||
|
||||
if (present(mask)) then
|
||||
if (size(mask) < size(idx)) then
|
||||
info = -1
|
||||
return
|
||||
end if
|
||||
end if
|
||||
if (present(lidx)) then
|
||||
if (size(lidx) < size(idx)) then
|
||||
info = -1
|
||||
return
|
||||
end if
|
||||
end if
|
||||
|
||||
|
||||
if (idxmap%is_asb()) then
|
||||
! State is wrong for this one !
|
||||
idx = -1
|
||||
info = -1
|
||||
|
||||
else if (idxmap%is_valid()) then
|
||||
|
||||
if (present(lidx)) then
|
||||
if (present(mask)) then
|
||||
do i=1, is
|
||||
if (mask(i)) then
|
||||
if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then
|
||||
ix = idxmap%glob_to_loc(idx(i))
|
||||
if (ix < 0) then
|
||||
ix = lidx(i)
|
||||
call psb_ensure_size(ix,idxmap%loc_to_glob,info,addsz=laddsz)
|
||||
if ((ix <= idxmap%local_rows).or.(info /= 0)) then
|
||||
info = -4
|
||||
return
|
||||
end if
|
||||
idxmap%local_cols = max(ix,idxmap%local_cols)
|
||||
idxmap%loc_to_glob(ix) = idx(i)
|
||||
idxmap%glob_to_loc(idx(i)) = ix
|
||||
end if
|
||||
idx(i) = ix
|
||||
else
|
||||
idx(i) = -1
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
|
||||
else if (.not.present(mask)) then
|
||||
|
||||
do i=1, is
|
||||
if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then
|
||||
ix = idxmap%glob_to_loc(idx(i))
|
||||
if (ix < 0) then
|
||||
ix = lidx(i)
|
||||
call psb_ensure_size(ix,idxmap%loc_to_glob,info,addsz=laddsz)
|
||||
if ((ix <= idxmap%local_rows).or.(info /= 0)) then
|
||||
info = -4
|
||||
return
|
||||
end if
|
||||
idxmap%local_cols = max(ix,idxmap%local_cols)
|
||||
idxmap%loc_to_glob(ix) = idx(i)
|
||||
idxmap%glob_to_loc(idx(i)) = ix
|
||||
end if
|
||||
idx(i) = ix
|
||||
else
|
||||
idx(i) = -1
|
||||
end if
|
||||
end do
|
||||
end if
|
||||
|
||||
else if (.not.present(lidx)) then
|
||||
|
||||
if (present(mask)) then
|
||||
do i=1, is
|
||||
if (mask(i)) then
|
||||
if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then
|
||||
ix = idxmap%glob_to_loc(idx(i))
|
||||
if (ix < 0) then
|
||||
ix = idxmap%local_cols + 1
|
||||
call psb_ensure_size(ix,idxmap%loc_to_glob,info,addsz=laddsz)
|
||||
if (info /= 0) then
|
||||
info = -4
|
||||
return
|
||||
end if
|
||||
idxmap%local_cols = ix
|
||||
idxmap%loc_to_glob(ix) = idx(i)
|
||||
idxmap%glob_to_loc(idx(i)) = ix
|
||||
end if
|
||||
idx(i) = ix
|
||||
else
|
||||
idx(i) = -1
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
|
||||
else if (.not.present(mask)) then
|
||||
|
||||
do i=1, is
|
||||
if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then
|
||||
ix = idxmap%glob_to_loc(idx(i))
|
||||
if (ix < 0) then
|
||||
ix = idxmap%local_cols + 1
|
||||
call psb_ensure_size(ix,idxmap%loc_to_glob,info,addsz=laddsz)
|
||||
if (info /= 0) then
|
||||
info = -4
|
||||
return
|
||||
end if
|
||||
idxmap%local_cols = ix
|
||||
idxmap%loc_to_glob(ix) = idx(i)
|
||||
idxmap%glob_to_loc(idx(i)) = ix
|
||||
end if
|
||||
idx(i) = ix
|
||||
else
|
||||
idx(i) = -1
|
||||
end if
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
|
||||
else
|
||||
idx = -1
|
||||
info = -1
|
||||
end if
|
||||
|
||||
end subroutine list_g2lv1_ins
|
||||
|
||||
subroutine list_g2lv2_ins(idxin,idxout,idxmap,info,mask,lidx)
|
||||
implicit none
|
||||
class(psb_list_map), intent(inout) :: idxmap
|
||||
integer(psb_ipk_), intent(in) :: idxin(:)
|
||||
integer(psb_ipk_), intent(out) :: idxout(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
integer(psb_ipk_), intent(in), optional :: lidx(:)
|
||||
|
||||
integer(psb_ipk_) :: is, im
|
||||
|
||||
is = size(idxin)
|
||||
im = min(is,size(idxout))
|
||||
idxout(1:im) = idxin(1:im)
|
||||
call idxmap%g2lip_ins(idxout(1:im),info,mask=mask,lidx=lidx)
|
||||
if (is > im) info = -3
|
||||
|
||||
end subroutine list_g2lv2_ins
|
||||
|
||||
|
||||
|
||||
|
||||
subroutine list_initvl(idxmap,ictxt,vl,info)
|
||||
use psb_penv_mod
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psb_list_map), intent(inout) :: idxmap
|
||||
integer(psb_mpik_), intent(in) :: ictxt
|
||||
integer(psb_ipk_), intent(in) :: vl(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! To be implemented
|
||||
integer(psb_ipk_) :: i, ix, nl, n, nrt
|
||||
integer(psb_mpik_) :: iam, np
|
||||
|
||||
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(psb_ipk_), intent(out) :: info
|
||||
|
||||
integer(psb_ipk_) :: nhal
|
||||
integer(psb_mpik_) :: 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() result(res)
|
||||
implicit none
|
||||
character(len=5) :: res
|
||||
res = 'LIST'
|
||||
end function list_get_fmt
|
||||
|
||||
|
||||
subroutine list_clone(idxmap,outmap,info)
|
||||
use psb_penv_mod
|
||||
use psb_error_mod
|
||||
use psb_realloc_mod
|
||||
implicit none
|
||||
class(psb_list_map), intent(inout) :: idxmap
|
||||
class(psb_indx_map), allocatable, intent(out) :: outmap
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='list_clone'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
info = psb_success_
|
||||
call psb_get_erraction(err_act)
|
||||
if (allocated(outmap)) then
|
||||
write(0,*) 'Error: should not be allocated on input'
|
||||
info = -87
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
allocate(psb_list_map :: outmap, stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
select type (outmap)
|
||||
type is (psb_list_map)
|
||||
if (info == psb_success_) then
|
||||
outmap%psb_indx_map = idxmap%psb_indx_map
|
||||
outmap%pnt_h = idxmap%pnt_h
|
||||
end if
|
||||
if (info == psb_success_)&
|
||||
& call psb_safe_ab_cpy(idxmap%loc_to_glob,outmap%loc_to_glob,info)
|
||||
if (info == psb_success_)&
|
||||
& call psb_safe_ab_cpy(idxmap%glob_to_loc,outmap%glob_to_loc,info)
|
||||
class default
|
||||
! This should be impossible
|
||||
info = -1
|
||||
end select
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_from_subroutine_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine list_clone
|
||||
|
||||
|
||||
subroutine list_reinit(idxmap,info)
|
||||
use psb_penv_mod
|
||||
use psb_error_mod
|
||||
use psb_realloc_mod
|
||||
implicit none
|
||||
class(psb_list_map), intent(inout) :: idxmap
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act, nr,nc,k, nl
|
||||
integer(psb_ipk_), allocatable :: idx(:),lidx(:)
|
||||
character(len=20) :: name='list_reinit'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
info = psb_success_
|
||||
|
||||
call idxmap%set_state(psb_desc_bld_)
|
||||
|
||||
return
|
||||
|
||||
end subroutine list_reinit
|
||||
|
||||
|
||||
end module psb_list_map_mod
|
||||
@@ -0,0 +1,826 @@
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.4
|
||||
!!$ (C) Copyright 2006, 2010, 2015
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
!
|
||||
!
|
||||
! package: psb_repl_map_mod
|
||||
! Defines the REPL_MAP type.
|
||||
! This is a replicated index space. It is also used
|
||||
! when NP=1. The answer to the query for the owning process
|
||||
! is always the local process, after all it's supposed to be
|
||||
! replicated; also, global to local index mapping is just the
|
||||
! identity, only thing to be done is to check the bounds.
|
||||
!
|
||||
!
|
||||
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, nopass :: is_repl => repl_is_repl
|
||||
procedure, pass(idxmap) :: asb => repl_asb
|
||||
procedure, pass(idxmap) :: free => repl_free
|
||||
procedure, pass(idxmap) :: clone => repl_clone
|
||||
procedure, pass(idxmap) :: reinit => repl_reinit
|
||||
procedure, nopass :: get_fmt => repl_get_fmt
|
||||
|
||||
procedure, pass(idxmap) :: l2gs1 => repl_l2gs1
|
||||
procedure, pass(idxmap) :: l2gs2 => repl_l2gs2
|
||||
procedure, pass(idxmap) :: l2gv1 => repl_l2gv1
|
||||
procedure, pass(idxmap) :: l2gv2 => repl_l2gv2
|
||||
|
||||
procedure, pass(idxmap) :: 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() result(val)
|
||||
implicit none
|
||||
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(psb_ipk_), intent(inout) :: idx
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
integer(psb_ipk_) :: idxv(1)
|
||||
info = 0
|
||||
if (present(mask)) then
|
||||
if (.not.mask) return
|
||||
end if
|
||||
|
||||
idxv(1) = idx
|
||||
call idxmap%l2gip(idxv,info,owned=owned)
|
||||
idx = idxv(1)
|
||||
|
||||
end subroutine repl_l2gs1
|
||||
|
||||
subroutine repl_l2gs2(idxin,idxout,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(in) :: idxmap
|
||||
integer(psb_ipk_), intent(in) :: idxin
|
||||
integer(psb_ipk_), intent(out) :: idxout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
idxout = idxin
|
||||
call idxmap%l2gip(idxout,info,mask,owned)
|
||||
|
||||
end subroutine repl_l2gs2
|
||||
|
||||
|
||||
subroutine repl_l2gv1(idx,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(in) :: idxmap
|
||||
integer(psb_ipk_), intent(inout) :: idx(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
integer(psb_ipk_) :: i
|
||||
logical :: owned_
|
||||
info = 0
|
||||
|
||||
if (present(mask)) then
|
||||
if (size(mask) < size(idx)) then
|
||||
info = -1
|
||||
return
|
||||
end if
|
||||
end if
|
||||
if (present(owned)) then
|
||||
owned_ = owned
|
||||
else
|
||||
owned_ = .false.
|
||||
end if
|
||||
|
||||
if (present(mask)) then
|
||||
|
||||
do i=1, size(idx)
|
||||
if (mask(i)) then
|
||||
if ((1<=idx(i)).and.(idx(i) <= idxmap%local_rows)) then
|
||||
! 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(psb_ipk_), intent(in) :: idxin(:)
|
||||
integer(psb_ipk_), intent(out) :: idxout(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
integer(psb_ipk_) :: is, im
|
||||
integer(psb_ipk_) :: i
|
||||
logical :: owned_
|
||||
|
||||
info = 0
|
||||
is = size(idxin)
|
||||
im = min(is,size(idxout))
|
||||
|
||||
if (present(mask)) then
|
||||
if (size(mask) < im) then
|
||||
info = -1
|
||||
return
|
||||
end if
|
||||
end if
|
||||
if (present(owned)) then
|
||||
owned_ = owned
|
||||
else
|
||||
owned_ = .false.
|
||||
end if
|
||||
|
||||
if (present(mask)) then
|
||||
|
||||
do i=1, im
|
||||
if (mask(i)) then
|
||||
if ((1<=idxin(i)).and.(idxin(i) <= idxmap%local_rows)) then
|
||||
idxout(i) = idxin(i)
|
||||
else
|
||||
idxout(i) = -1
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
|
||||
else if (.not.present(mask)) then
|
||||
|
||||
do i=1, im
|
||||
if ((1<=idxin(i)).and.(idxin(i) <= idxmap%local_rows)) then
|
||||
idxout(i) = idxin(i)
|
||||
else
|
||||
idxout(i) = -1
|
||||
end if
|
||||
end do
|
||||
|
||||
end if
|
||||
|
||||
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(psb_ipk_), intent(inout) :: idx
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
integer(psb_ipk_) :: idxv(1)
|
||||
info = 0
|
||||
|
||||
if (present(mask)) then
|
||||
if (.not.mask) return
|
||||
end if
|
||||
|
||||
idxv(1) = idx
|
||||
call idxmap%g2lip(idxv,info,owned=owned)
|
||||
idx = idxv(1)
|
||||
|
||||
end subroutine repl_g2ls1
|
||||
|
||||
subroutine repl_g2ls2(idxin,idxout,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(in) :: idxmap
|
||||
integer(psb_ipk_), intent(in) :: idxin
|
||||
integer(psb_ipk_), intent(out) :: idxout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
idxout = idxin
|
||||
call idxmap%g2lip(idxout,info,mask,owned)
|
||||
|
||||
end subroutine repl_g2ls2
|
||||
|
||||
|
||||
subroutine repl_g2lv1(idx,idxmap,info,mask,owned)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(in) :: idxmap
|
||||
integer(psb_ipk_), intent(inout) :: idx(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
integer(psb_ipk_) :: i, 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(psb_ipk_), intent(in) :: idxin(:)
|
||||
integer(psb_ipk_), intent(out) :: idxout(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
logical, intent(in), optional :: owned
|
||||
|
||||
integer(psb_ipk_) :: is, im,i
|
||||
logical :: owned_
|
||||
|
||||
info = 0
|
||||
|
||||
is = size(idxin)
|
||||
im = min(is,size(idxout))
|
||||
|
||||
if (present(mask)) then
|
||||
if (size(mask) < im) then
|
||||
info = -1
|
||||
return
|
||||
end if
|
||||
end if
|
||||
if (present(owned)) then
|
||||
owned_ = owned
|
||||
else
|
||||
owned_ = .false.
|
||||
end if
|
||||
|
||||
|
||||
if (present(mask)) then
|
||||
|
||||
if (idxmap%is_asb()) then
|
||||
do i=1, im
|
||||
if (mask(i)) then
|
||||
if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)) then
|
||||
idxout(i) = idxin(i)
|
||||
else
|
||||
idxout(i) = -1
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
else if (idxmap%is_valid()) then
|
||||
do i=1,im
|
||||
if (mask(i)) then
|
||||
if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)) then
|
||||
idxout(i) = idxin(i)
|
||||
else
|
||||
idxout(i) = -1
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
else
|
||||
idxout(1:im) = -1
|
||||
info = -1
|
||||
end if
|
||||
|
||||
else if (.not.present(mask)) then
|
||||
|
||||
if (idxmap%is_asb()) then
|
||||
do i=1, im
|
||||
if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)) then
|
||||
idxout(i) = idxin(i)
|
||||
else
|
||||
idxout(i) = -1
|
||||
end if
|
||||
end do
|
||||
else if (idxmap%is_valid()) then
|
||||
do i=1,im
|
||||
if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)) then
|
||||
idxout(i) = idxin(i)
|
||||
else
|
||||
idxout(i) = -1
|
||||
end if
|
||||
end do
|
||||
else
|
||||
idxout(1:im) = -1
|
||||
info = -1
|
||||
end if
|
||||
|
||||
end if
|
||||
|
||||
if (is > im) info = -3
|
||||
|
||||
end subroutine repl_g2lv2
|
||||
|
||||
|
||||
|
||||
subroutine repl_g2ls1_ins(idx,idxmap,info,mask, lidx)
|
||||
use psb_realloc_mod
|
||||
use psb_sort_mod
|
||||
implicit none
|
||||
class(psb_repl_map), intent(inout) :: idxmap
|
||||
integer(psb_ipk_), intent(inout) :: idx
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
integer(psb_ipk_), intent(in), optional :: lidx
|
||||
|
||||
integer(psb_ipk_) :: idxv(1),lidxv(1)
|
||||
|
||||
info = 0
|
||||
if (present(mask)) then
|
||||
if (.not.mask) return
|
||||
end if
|
||||
idxv(1) = idx
|
||||
if (present(lidx)) then
|
||||
lidxv(1) = lidx
|
||||
call idxmap%g2lip_ins(idxv,info,lidx=lidxv)
|
||||
else
|
||||
call idxmap%g2lip_ins(idxv,info)
|
||||
end if
|
||||
idx = idxv(1)
|
||||
|
||||
end subroutine repl_g2ls1_ins
|
||||
|
||||
subroutine repl_g2ls2_ins(idxin,idxout,idxmap,info,mask,lidx)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(inout) :: idxmap
|
||||
integer(psb_ipk_), intent(in) :: idxin
|
||||
integer(psb_ipk_), intent(out) :: idxout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask
|
||||
integer(psb_ipk_), intent(in), optional :: lidx
|
||||
|
||||
idxout = idxin
|
||||
call idxmap%g2lip_ins(idxout,info,mask=mask,lidx=lidx)
|
||||
|
||||
end subroutine repl_g2ls2_ins
|
||||
|
||||
|
||||
subroutine repl_g2lv1_ins(idx,idxmap,info,mask,lidx)
|
||||
use psb_realloc_mod
|
||||
use psb_sort_mod
|
||||
implicit none
|
||||
class(psb_repl_map), intent(inout) :: idxmap
|
||||
integer(psb_ipk_), intent(inout) :: idx(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
integer(psb_ipk_), intent(in), optional :: lidx(:)
|
||||
|
||||
integer(psb_ipk_) :: i, is
|
||||
|
||||
info = 0
|
||||
is = size(idx)
|
||||
|
||||
if (present(mask)) then
|
||||
if (size(mask) < size(idx)) then
|
||||
info = -1
|
||||
return
|
||||
end if
|
||||
end if
|
||||
if (present(lidx)) then
|
||||
if (size(lidx) < size(idx)) then
|
||||
info = -1
|
||||
return
|
||||
end if
|
||||
end if
|
||||
|
||||
|
||||
if (idxmap%is_asb()) then
|
||||
! State is wrong for this one !
|
||||
idx = -1
|
||||
info = -1
|
||||
|
||||
else if (idxmap%is_valid()) then
|
||||
if (present(lidx)) then
|
||||
if (present(mask)) then
|
||||
do i=1, is
|
||||
if (mask(i)) then
|
||||
if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then
|
||||
! 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 if (.not.present(lidx)) then
|
||||
if (present(mask)) then
|
||||
do i=1, is
|
||||
if (mask(i)) then
|
||||
if ((1<= idx(i)).and.(idx(i) <= idxmap%global_rows)) then
|
||||
! 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
|
||||
end if
|
||||
else
|
||||
idx = -1
|
||||
info = -1
|
||||
end if
|
||||
|
||||
end subroutine repl_g2lv1_ins
|
||||
|
||||
subroutine repl_g2lv2_ins(idxin,idxout,idxmap,info,mask,lidx)
|
||||
implicit none
|
||||
class(psb_repl_map), intent(inout) :: idxmap
|
||||
integer(psb_ipk_), intent(in) :: idxin(:)
|
||||
integer(psb_ipk_), intent(out) :: idxout(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: mask(:)
|
||||
integer(psb_ipk_), intent(in), optional :: lidx(:)
|
||||
|
||||
integer(psb_ipk_) :: is, im, i
|
||||
|
||||
|
||||
info = 0
|
||||
is = size(idxin)
|
||||
im = min(is,size(idxout))
|
||||
|
||||
if (present(mask)) then
|
||||
if (size(mask) < im) then
|
||||
info = -1
|
||||
return
|
||||
end if
|
||||
end if
|
||||
if (present(lidx)) then
|
||||
if (size(lidx) < im) then
|
||||
info = -1
|
||||
return
|
||||
end if
|
||||
end if
|
||||
|
||||
|
||||
if (idxmap%is_asb()) then
|
||||
! State is wrong for this one !
|
||||
idxout = -1
|
||||
info = -1
|
||||
|
||||
else if (idxmap%is_valid()) then
|
||||
if (present(lidx)) then
|
||||
if (present(mask)) then
|
||||
do i=1, im
|
||||
if (mask(i)) then
|
||||
if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)) then
|
||||
idxout(i) = idxin(i)
|
||||
else
|
||||
idxout(i) = -1
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
|
||||
else if (.not.present(mask)) then
|
||||
|
||||
do i=1, im
|
||||
if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)) then
|
||||
idxout(i) = idxin(i)
|
||||
else
|
||||
idxout(i) = -1
|
||||
end if
|
||||
end do
|
||||
end if
|
||||
else if (.not.present(lidx)) then
|
||||
if (present(mask)) then
|
||||
do i=1, im
|
||||
if (mask(i)) then
|
||||
if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)) then
|
||||
idxout(i) = idxin(i)
|
||||
else
|
||||
idxout(i) = -1
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
|
||||
else if (.not.present(mask)) then
|
||||
do i=1, im
|
||||
if ((1<= idxin(i)).and.(idxin(i) <= idxmap%global_rows)) then
|
||||
idxout(i) = idxin(i)
|
||||
else
|
||||
idxout(i) = -1
|
||||
end if
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
else
|
||||
idxout = -1
|
||||
info = -1
|
||||
end if
|
||||
|
||||
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(psb_ipk_), intent(in) :: idx(:)
|
||||
integer(psb_ipk_), allocatable, intent(out) :: iprc(:)
|
||||
class(psb_repl_map), intent(in) :: idxmap
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: nv
|
||||
integer(psb_mpik_) :: ictxt, iam, np
|
||||
|
||||
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
|
||||
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(psb_ipk_), intent(in) :: nl
|
||||
integer(psb_mpik_), intent(in) :: ictxt
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! To be implemented
|
||||
integer(psb_mpik_) :: iam, np
|
||||
|
||||
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(psb_ipk_), intent(out) :: info
|
||||
|
||||
integer(psb_mpik_) :: 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() result(res)
|
||||
implicit none
|
||||
character(len=5) :: res
|
||||
res = 'REPL'
|
||||
end function repl_get_fmt
|
||||
|
||||
|
||||
subroutine repl_clone(idxmap,outmap,info)
|
||||
use psb_penv_mod
|
||||
use psb_error_mod
|
||||
use psb_realloc_mod
|
||||
implicit none
|
||||
class(psb_repl_map), intent(inout) :: idxmap
|
||||
class(psb_indx_map), allocatable, intent(out) :: outmap
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='repl_clone'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
info = psb_success_
|
||||
call psb_get_erraction(err_act)
|
||||
if (allocated(outmap)) then
|
||||
write(0,*) 'Error: should not be allocated on input'
|
||||
info = -87
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
allocate(psb_repl_map :: outmap, stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
select type (outmap)
|
||||
type is (psb_repl_map)
|
||||
outmap%psb_indx_map = idxmap%psb_indx_map
|
||||
class default
|
||||
! This should be impossible
|
||||
info = -1
|
||||
end select
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_from_subroutine_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine repl_clone
|
||||
|
||||
subroutine repl_reinit(idxmap,info)
|
||||
use psb_penv_mod
|
||||
use psb_error_mod
|
||||
use psb_realloc_mod
|
||||
implicit none
|
||||
class(psb_repl_map), intent(inout) :: idxmap
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act, nr,nc,k, nl
|
||||
integer(psb_ipk_), allocatable :: idx(:),lidx(:)
|
||||
character(len=20) :: name='repl_reinit'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
info = psb_success_
|
||||
|
||||
call idxmap%set_state(psb_desc_bld_)
|
||||
|
||||
return
|
||||
|
||||
end subroutine repl_reinit
|
||||
|
||||
end module psb_repl_map_mod
|
||||
Reference in New Issue
Block a user