|
|
|
@ -54,31 +54,32 @@
|
|
|
|
|
! uses information prepared by the previous two subroutines.
|
|
|
|
|
!
|
|
|
|
|
module psb_metispart_mod
|
|
|
|
|
use psb_base_mod, only : psb_sspmat_type, psb_cspmat_type,&
|
|
|
|
|
& psb_dspmat_type, psb_zspmat_type, psb_err_unit, &
|
|
|
|
|
& psb_ipk_, psb_lpk_, psb_mpk_, psb_epk_, psb_spk_,&
|
|
|
|
|
& psb_s_csr_sparse_mat, psb_d_csr_sparse_mat, &
|
|
|
|
|
& psb_c_csr_sparse_mat, psb_z_csr_sparse_mat
|
|
|
|
|
use psb_base_mod, only : psb_ipk_, psb_lpk_, psb_mpk_, psb_epk_, &
|
|
|
|
|
& psb_err_unit, psb_spk_,&
|
|
|
|
|
& psb_lsspmat_type, psb_lcspmat_type,&
|
|
|
|
|
& psb_ldspmat_type, psb_lzspmat_type, &
|
|
|
|
|
& psb_ls_csr_sparse_mat, psb_ld_csr_sparse_mat, &
|
|
|
|
|
& psb_lc_csr_sparse_mat, psb_lz_csr_sparse_mat
|
|
|
|
|
public part_graph, build_mtpart, distr_mtpart,&
|
|
|
|
|
& getv_mtpart, free_part
|
|
|
|
|
private
|
|
|
|
|
integer(psb_ipk_), allocatable, save :: graph_vect(:)
|
|
|
|
|
integer(psb_lpk_), allocatable, save :: graph_vect(:)
|
|
|
|
|
|
|
|
|
|
interface build_mtpart
|
|
|
|
|
module procedure d_mat_build_mtpart, s_mat_build_mtpart,&
|
|
|
|
|
& z_mat_build_mtpart, c_mat_build_mtpart
|
|
|
|
|
module procedure ld_mat_build_mtpart, ls_mat_build_mtpart,&
|
|
|
|
|
& lz_mat_build_mtpart, lc_mat_build_mtpart
|
|
|
|
|
end interface
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
subroutine psi_build_mtpart(n,ja,irp,nparts,vect, weights)
|
|
|
|
|
import :: psb_ipk_, psb_spk_
|
|
|
|
|
interface psi_build_mtpart
|
|
|
|
|
subroutine psi_l_build_mtpart(n,ja,irp,nparts,vect, weights)
|
|
|
|
|
import :: psb_lpk_, psb_spk_
|
|
|
|
|
implicit none
|
|
|
|
|
integer(psb_ipk_), intent(in) :: n, nparts
|
|
|
|
|
integer(psb_ipk_), intent(in) :: ja(:), irp(:)
|
|
|
|
|
integer(psb_ipk_), allocatable, intent(inout) :: vect(:)
|
|
|
|
|
integer(psb_lpk_), intent(in) :: n, nparts
|
|
|
|
|
integer(psb_lpk_), intent(in) :: ja(:), irp(:)
|
|
|
|
|
integer(psb_lpk_), allocatable, intent(inout) :: vect(:)
|
|
|
|
|
real(psb_spk_),optional, intent(in) :: weights(:)
|
|
|
|
|
|
|
|
|
|
end subroutine psi_build_mtpart
|
|
|
|
|
end subroutine psi_l_build_mtpart
|
|
|
|
|
end interface
|
|
|
|
|
|
|
|
|
|
contains
|
|
|
|
@ -156,28 +157,29 @@ contains
|
|
|
|
|
end if
|
|
|
|
|
end subroutine getv_mtpart
|
|
|
|
|
|
|
|
|
|
subroutine d_mat_build_mtpart(a,nparts,weights)
|
|
|
|
|
|
|
|
|
|
subroutine ld_mat_build_mtpart(a,nparts,weights)
|
|
|
|
|
use psb_base_mod
|
|
|
|
|
implicit none
|
|
|
|
|
type(psb_dspmat_type), intent(in) :: a
|
|
|
|
|
integer(psb_ipk_) :: nparts
|
|
|
|
|
type(psb_ldspmat_type), intent(in) :: a
|
|
|
|
|
integer(psb_lpk_) :: nparts
|
|
|
|
|
real(psb_dpk_), optional :: weights(:)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select type (aa=>a%a)
|
|
|
|
|
type is (psb_d_csr_sparse_mat)
|
|
|
|
|
call d_csr_build_mtpart(aa,nparts,weights)
|
|
|
|
|
type is (psb_ld_csr_sparse_mat)
|
|
|
|
|
call ld_csr_build_mtpart(aa,nparts,weights)
|
|
|
|
|
class default
|
|
|
|
|
write(psb_err_unit,*) 'Sorry, right now we only take CSR input!'
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
|
|
end subroutine d_mat_build_mtpart
|
|
|
|
|
end subroutine ld_mat_build_mtpart
|
|
|
|
|
|
|
|
|
|
subroutine d_csr_build_mtpart(a,nparts,weights)
|
|
|
|
|
subroutine ld_csr_build_mtpart(a,nparts,weights)
|
|
|
|
|
use psb_base_mod
|
|
|
|
|
implicit none
|
|
|
|
|
type(psb_d_csr_sparse_mat), intent(in) :: a
|
|
|
|
|
integer(psb_ipk_) :: nparts
|
|
|
|
|
type(psb_ld_csr_sparse_mat), intent(in) :: a
|
|
|
|
|
integer(psb_lpk_) :: nparts
|
|
|
|
|
real(psb_dpk_), optional :: weights(:)
|
|
|
|
|
real(psb_spk_), allocatable :: wgh_(:)
|
|
|
|
|
|
|
|
|
@ -193,30 +195,30 @@ contains
|
|
|
|
|
call psi_build_mtpart(a%get_nrows(),a%ja,a%irp,nparts,graph_vect)
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
end subroutine d_csr_build_mtpart
|
|
|
|
|
end subroutine ld_csr_build_mtpart
|
|
|
|
|
|
|
|
|
|
subroutine z_mat_build_mtpart(a,nparts,weights)
|
|
|
|
|
subroutine lz_mat_build_mtpart(a,nparts,weights)
|
|
|
|
|
use psb_base_mod
|
|
|
|
|
implicit none
|
|
|
|
|
type(psb_zspmat_type), intent(in) :: a
|
|
|
|
|
integer(psb_ipk_) :: nparts
|
|
|
|
|
type(psb_lzspmat_type), intent(in) :: a
|
|
|
|
|
integer(psb_lpk_) :: nparts
|
|
|
|
|
real(psb_dpk_), optional :: weights(:)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select type (aa=>a%a)
|
|
|
|
|
type is (psb_z_csr_sparse_mat)
|
|
|
|
|
call z_csr_build_mtpart(aa,nparts,weights)
|
|
|
|
|
type is (psb_lz_csr_sparse_mat)
|
|
|
|
|
call lz_csr_build_mtpart(aa,nparts,weights)
|
|
|
|
|
class default
|
|
|
|
|
write(psb_err_unit,*) 'Sorry, right now we only take CSR input!'
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
|
|
end subroutine z_mat_build_mtpart
|
|
|
|
|
end subroutine lz_mat_build_mtpart
|
|
|
|
|
|
|
|
|
|
subroutine z_csr_build_mtpart(a,nparts,weights)
|
|
|
|
|
subroutine lz_csr_build_mtpart(a,nparts,weights)
|
|
|
|
|
use psb_base_mod
|
|
|
|
|
implicit none
|
|
|
|
|
type(psb_z_csr_sparse_mat), intent(in) :: a
|
|
|
|
|
integer(psb_ipk_) :: nparts
|
|
|
|
|
type(psb_lz_csr_sparse_mat), intent(in) :: a
|
|
|
|
|
integer(psb_lpk_) :: nparts
|
|
|
|
|
real(psb_dpk_), optional :: weights(:)
|
|
|
|
|
real(psb_spk_), allocatable :: wgh_(:)
|
|
|
|
|
|
|
|
|
@ -232,65 +234,65 @@ contains
|
|
|
|
|
call psi_build_mtpart(a%get_nrows(),a%ja,a%irp,nparts,graph_vect)
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
end subroutine z_csr_build_mtpart
|
|
|
|
|
end subroutine lz_csr_build_mtpart
|
|
|
|
|
|
|
|
|
|
subroutine s_mat_build_mtpart(a,nparts,weights)
|
|
|
|
|
subroutine ls_mat_build_mtpart(a,nparts,weights)
|
|
|
|
|
use psb_base_mod
|
|
|
|
|
implicit none
|
|
|
|
|
type(psb_sspmat_type), intent(in) :: a
|
|
|
|
|
integer(psb_ipk_) :: nparts
|
|
|
|
|
type(psb_lsspmat_type), intent(in) :: a
|
|
|
|
|
integer(psb_lpk_) :: nparts
|
|
|
|
|
real(psb_spk_), optional :: weights(:)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select type (aa=>a%a)
|
|
|
|
|
type is (psb_s_csr_sparse_mat)
|
|
|
|
|
call s_csr_build_mtpart(aa,nparts,weights)
|
|
|
|
|
type is (psb_ls_csr_sparse_mat)
|
|
|
|
|
call ls_csr_build_mtpart(aa,nparts,weights)
|
|
|
|
|
class default
|
|
|
|
|
write(psb_err_unit,*) 'Sorry, right now we only take CSR input!'
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
|
|
end subroutine s_mat_build_mtpart
|
|
|
|
|
end subroutine ls_mat_build_mtpart
|
|
|
|
|
|
|
|
|
|
subroutine c_mat_build_mtpart(a,nparts,weights)
|
|
|
|
|
subroutine lc_mat_build_mtpart(a,nparts,weights)
|
|
|
|
|
use psb_base_mod
|
|
|
|
|
implicit none
|
|
|
|
|
type(psb_cspmat_type), intent(in) :: a
|
|
|
|
|
integer(psb_ipk_) :: nparts
|
|
|
|
|
type(psb_lcspmat_type), intent(in) :: a
|
|
|
|
|
integer(psb_lpk_) :: nparts
|
|
|
|
|
real(psb_spk_), optional :: weights(:)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select type (aa=>a%a)
|
|
|
|
|
type is (psb_c_csr_sparse_mat)
|
|
|
|
|
call c_csr_build_mtpart(aa,nparts,weights)
|
|
|
|
|
type is (psb_lc_csr_sparse_mat)
|
|
|
|
|
call lc_csr_build_mtpart(aa,nparts,weights)
|
|
|
|
|
class default
|
|
|
|
|
write(psb_err_unit,*) 'Sorry, right now we only take CSR input!'
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
|
|
end subroutine c_mat_build_mtpart
|
|
|
|
|
end subroutine lc_mat_build_mtpart
|
|
|
|
|
|
|
|
|
|
subroutine c_csr_build_mtpart(a,nparts,weights)
|
|
|
|
|
subroutine lc_csr_build_mtpart(a,nparts,weights)
|
|
|
|
|
use psb_base_mod
|
|
|
|
|
implicit none
|
|
|
|
|
type(psb_c_csr_sparse_mat), intent(in) :: a
|
|
|
|
|
integer(psb_ipk_) :: nparts
|
|
|
|
|
type(psb_lc_csr_sparse_mat), intent(in) :: a
|
|
|
|
|
integer(psb_lpk_) :: nparts
|
|
|
|
|
real(psb_spk_), optional :: weights(:)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call psi_build_mtpart(a%get_nrows(),a%ja,a%irp,nparts,graph_vect,weights)
|
|
|
|
|
|
|
|
|
|
end subroutine c_csr_build_mtpart
|
|
|
|
|
end subroutine lc_csr_build_mtpart
|
|
|
|
|
|
|
|
|
|
subroutine s_csr_build_mtpart(a,nparts,weights)
|
|
|
|
|
subroutine ls_csr_build_mtpart(a,nparts,weights)
|
|
|
|
|
use psb_base_mod
|
|
|
|
|
implicit none
|
|
|
|
|
type(psb_s_csr_sparse_mat), intent(in) :: a
|
|
|
|
|
integer(psb_ipk_) :: nparts
|
|
|
|
|
type(psb_ls_csr_sparse_mat), intent(in) :: a
|
|
|
|
|
integer(psb_lpk_) :: nparts
|
|
|
|
|
real(psb_spk_), optional :: weights(:)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call psi_build_mtpart(a%get_nrows(),a%ja,a%irp,nparts,graph_vect,weights)
|
|
|
|
|
|
|
|
|
|
end subroutine s_csr_build_mtpart
|
|
|
|
|
end subroutine ls_csr_build_mtpart
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
|
! WARNING: called IRET otherwise Intel compiler complains,
|
|
|
|
|