psblas3:
Changelog LICENSE Make.inc.in README base/Makefile base/internals/psi_bld_tmphalo.f90 base/internals/psi_bld_tmpovrl.f90 base/internals/psi_crea_bnd_elem.f90 base/internals/psi_crea_index.f90 base/internals/psi_crea_ovr_elem.f90 base/internals/psi_fnd_owner.F90 base/modules/Makefile base/modules/psb_base_mod.f90 base/modules/psb_desc_type.f90 base/modules/psb_hash_mod.f90 base/modules/psb_linmap_mod.f90 base/modules/psb_linmap_type_mod.f90 base/modules/psb_penv_mod.F90 base/modules/psb_psblas_mod.f90 base/modules/psb_realloc_mod.F90 base/modules/psb_serial_mod.f90 base/modules/psb_sort_mod.f90 base/modules/psb_spmat_type.f03 base/modules/psb_spmat_type.f90 base/modules/psb_tools_mod.f90 base/modules/psi_mod.f90 base/psblas/Makefile base/psblas/psb_cspmm.f90 base/psblas/psb_dspmm.f90 base/psblas/psb_sspmm.f90 base/psblas/psb_zspmm.f90 base/serial/Makefile base/serial/aux/Makefile base/serial/psb_ccoins.f90 base/serial/psb_ccsprt.f90 base/serial/psb_cgelp.f90 base/serial/psb_cipcoo2csc.f90 base/serial/psb_cipcoo2csr.f90 base/serial/psb_cipcsr2coo.f90 base/serial/psb_cneigh.f90 base/serial/psb_ctransc.f90 base/serial/psb_ctransp.f90 base/serial/psb_dcoins.f90 base/serial/psb_dcsmm.f90 base/serial/psb_dcsprt.f90 base/serial/psb_dcsrp.f90 base/serial/psb_dgelp.f90 base/serial/psb_dipcoo2csc.f90 base/serial/psb_dipcoo2csr.f90 base/serial/psb_dipcsr2coo.f90 base/serial/psb_dneigh.f90 base/serial/psb_dtransp.f90 base/serial/psb_getrow_mod.f90 base/serial/psb_scoins.f90 base/serial/psb_scsnmi.f90 base/serial/psb_scsprt.f90 base/serial/psb_sgelp.f90 base/serial/psb_sipcoo2csc.f90 base/serial/psb_sipcoo2csr.f90 base/serial/psb_sipcsr2coo.f90 base/serial/psb_sneigh.f90 base/serial/psb_stransp.f90 base/serial/psb_update_mod.f90 base/serial/psb_zcoins.f90 base/serial/psb_zcsprt.f90 base/serial/psb_zcsrp.f90 base/serial/psb_zgelp.f90 base/serial/psb_zipcoo2csc.f90 base/serial/psb_zipcoo2csr.f90 base/serial/psb_zipcsr2coo.f90 base/serial/psb_zneigh.f90 base/serial/psb_ztransc.f90 base/serial/psb_ztransp.f90 base/tools/Makefile base/tools/psb_ccdbldext.F90 base/tools/psb_cd_lstext.f90 base/tools/psb_cd_reinit.f90 base/tools/psb_cdals.f90 base/tools/psb_cdren.f90 base/tools/psb_dcdbldext.F90 base/tools/psb_icdasb.F90 base/tools/psb_inter_desc.f90 base/tools/psb_linmap.f90 base/tools/psb_map.f90 base/tools/psb_scdbldext.F90 base/tools/psb_zcdbldext.F90 config/pac.m4 configure.ac configure krylov/psb_scgstab.F90 prec/psb_cdiagsc_bld.f90 prec/psb_cprc_aply.f90 prec/psb_cprecbld.f90 prec/psb_ddiagsc_bld.f90 prec/psb_dprc_aply.f90 prec/psb_dprecbld.f90 prec/psb_sdiagsc_bld.f90 prec/psb_sprc_aply.f90 prec/psb_sprecbld.f90 prec/psb_zdiagsc_bld.f90 prec/psb_zprc_aply.f90 prec/psb_zprecbld.f90 test/fileread/cf_sample.f90 test/fileread/df_sample.f90 test/fileread/sf_sample.f90 test/fileread/zf_sample.f90 test/pargen/ppde.f90 test/pargen/runs/ppde.inp test/pargen/spde.f90 util/psb_mat_dist_mod.f90 psblas3: first batch of changes to accommodate NAG compiler. Now the real work is about to start...psblas3-type-indexed
parent
9765e4a4ae
commit
8766c1003b
@ -0,0 +1,661 @@
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 2.2
|
||||
!!$ (C) Copyright 2006/2007/2008
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari University of Rome Tor Vergata
|
||||
!!$
|
||||
!!$ 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_linmap_mod
|
||||
! Defines facilities for mapping between vectors belonging
|
||||
! to different spaces.
|
||||
!
|
||||
module psb_linmap_mod
|
||||
|
||||
use psb_spmat_type, only : psb_sspmat_type, psb_dspmat_type, &
|
||||
& psb_cspmat_type, psb_zspmat_type, psb_spk_, psb_dpk_, psb_sizeof
|
||||
use psb_descriptor_type
|
||||
use psb_linmap_type_mod
|
||||
|
||||
|
||||
interface psb_map_X2Y
|
||||
subroutine psb_s_map_X2Y(alpha,x,beta,y,map,info,work)
|
||||
use psb_linmap_type_mod
|
||||
implicit none
|
||||
type(psb_slinmap_type), intent(in) :: map
|
||||
real(psb_spk_), intent(in) :: alpha,beta
|
||||
real(psb_spk_), intent(inout) :: x(:)
|
||||
real(psb_spk_), intent(out) :: y(:)
|
||||
integer, intent(out) :: info
|
||||
real(psb_spk_), optional :: work(:)
|
||||
end subroutine psb_s_map_X2Y
|
||||
subroutine psb_d_map_X2Y(alpha,x,beta,y,map,info,work)
|
||||
use psb_linmap_type_mod
|
||||
implicit none
|
||||
type(psb_dlinmap_type), intent(in) :: map
|
||||
real(psb_dpk_), intent(in) :: alpha,beta
|
||||
real(psb_dpk_), intent(inout) :: x(:)
|
||||
real(psb_dpk_), intent(out) :: y(:)
|
||||
integer, intent(out) :: info
|
||||
real(psb_dpk_), optional :: work(:)
|
||||
end subroutine psb_d_map_X2Y
|
||||
subroutine psb_c_map_X2Y(alpha,x,beta,y,map,info,work)
|
||||
use psb_linmap_type_mod
|
||||
implicit none
|
||||
type(psb_clinmap_type), intent(in) :: map
|
||||
complex(psb_spk_), intent(in) :: alpha,beta
|
||||
complex(psb_spk_), intent(inout) :: x(:)
|
||||
complex(psb_spk_), intent(out) :: y(:)
|
||||
integer, intent(out) :: info
|
||||
complex(psb_spk_), optional :: work(:)
|
||||
end subroutine psb_c_map_X2Y
|
||||
subroutine psb_z_map_X2Y(alpha,x,beta,y,map,info,work)
|
||||
use psb_linmap_type_mod
|
||||
implicit none
|
||||
type(psb_zlinmap_type), intent(in) :: map
|
||||
complex(psb_dpk_), intent(in) :: alpha,beta
|
||||
complex(psb_dpk_), intent(inout) :: x(:)
|
||||
complex(psb_dpk_), intent(out) :: y(:)
|
||||
integer, intent(out) :: info
|
||||
complex(psb_dpk_), optional :: work(:)
|
||||
end subroutine psb_z_map_X2Y
|
||||
end interface
|
||||
|
||||
interface psb_map_Y2X
|
||||
subroutine psb_s_map_Y2X(alpha,x,beta,y,map,info,work)
|
||||
use psb_linmap_type_mod
|
||||
implicit none
|
||||
type(psb_slinmap_type), intent(in) :: map
|
||||
real(psb_spk_), intent(in) :: alpha,beta
|
||||
real(psb_spk_), intent(inout) :: x(:)
|
||||
real(psb_spk_), intent(out) :: y(:)
|
||||
integer, intent(out) :: info
|
||||
real(psb_spk_), optional :: work(:)
|
||||
end subroutine psb_s_map_Y2X
|
||||
subroutine psb_d_map_Y2X(alpha,x,beta,y,map,info,work)
|
||||
use psb_linmap_type_mod
|
||||
implicit none
|
||||
type(psb_dlinmap_type), intent(in) :: map
|
||||
real(psb_dpk_), intent(in) :: alpha,beta
|
||||
real(psb_dpk_), intent(inout) :: x(:)
|
||||
real(psb_dpk_), intent(out) :: y(:)
|
||||
integer, intent(out) :: info
|
||||
real(psb_dpk_), optional :: work(:)
|
||||
end subroutine psb_d_map_Y2X
|
||||
subroutine psb_c_map_Y2X(alpha,x,beta,y,map,info,work)
|
||||
use psb_linmap_type_mod
|
||||
implicit none
|
||||
type(psb_clinmap_type), intent(in) :: map
|
||||
complex(psb_spk_), intent(in) :: alpha,beta
|
||||
complex(psb_spk_), intent(inout) :: x(:)
|
||||
complex(psb_spk_), intent(out) :: y(:)
|
||||
integer, intent(out) :: info
|
||||
complex(psb_spk_), optional :: work(:)
|
||||
end subroutine psb_c_map_Y2X
|
||||
subroutine psb_z_map_Y2X(alpha,x,beta,y,map,info,work)
|
||||
use psb_linmap_type_mod
|
||||
implicit none
|
||||
type(psb_zlinmap_type), intent(in) :: map
|
||||
complex(psb_dpk_), intent(in) :: alpha,beta
|
||||
complex(psb_dpk_), intent(inout) :: x(:)
|
||||
complex(psb_dpk_), intent(out) :: y(:)
|
||||
integer, intent(out) :: info
|
||||
complex(psb_dpk_), optional :: work(:)
|
||||
end subroutine psb_z_map_Y2X
|
||||
end interface
|
||||
|
||||
|
||||
interface psb_is_ok_map
|
||||
module procedure psb_is_ok_slinmap, psb_is_ok_dlinmap, &
|
||||
& psb_is_ok_clinmap, psb_is_ok_zlinmap
|
||||
end interface
|
||||
|
||||
interface psb_get_map_kind
|
||||
module procedure psb_get_smap_kind, psb_get_dmap_kind, &
|
||||
& psb_get_cmap_kind, psb_get_zmap_kind
|
||||
end interface
|
||||
|
||||
interface psb_set_map_kind
|
||||
module procedure psb_set_smap_kind, psb_set_dmap_kind, &
|
||||
& psb_set_cmap_kind, psb_set_zmap_kind
|
||||
end interface
|
||||
|
||||
interface psb_is_asb_map
|
||||
module procedure psb_is_asb_slinmap, psb_is_asb_dlinmap, &
|
||||
& psb_is_asb_clinmap, psb_is_asb_zlinmap
|
||||
end interface
|
||||
|
||||
interface psb_linmap_sub
|
||||
module procedure psb_s_linmap_sub, psb_d_linmap_sub, &
|
||||
& psb_c_linmap_sub, psb_z_linmap_sub
|
||||
end interface
|
||||
|
||||
interface psb_move_alloc
|
||||
module procedure psb_slinmap_transfer, psb_dlinmap_transfer, &
|
||||
& psb_clinmap_transfer, psb_zlinmap_transfer
|
||||
end interface
|
||||
|
||||
interface psb_linmap
|
||||
function psb_s_linmap(map_kind,desc_X, desc_Y, map_X2Y, map_Y2X,iaggr,naggr)
|
||||
use psb_linmap_type_mod
|
||||
implicit none
|
||||
type(psb_slinmap_type) :: psb_s_linmap
|
||||
type(psb_desc_type), target :: desc_X, desc_Y
|
||||
type(psb_sspmat_type), intent(in) :: map_X2Y, map_Y2X
|
||||
integer, intent(in) :: map_kind
|
||||
integer, intent(in), optional :: iaggr(:), naggr(:)
|
||||
end function psb_s_linmap
|
||||
function psb_d_linmap(map_kind,desc_X, desc_Y, map_X2Y, map_Y2X,iaggr,naggr)
|
||||
use psb_linmap_type_mod
|
||||
implicit none
|
||||
type(psb_dlinmap_type) :: psb_d_linmap
|
||||
type(psb_desc_type), target :: desc_X, desc_Y
|
||||
type(psb_dspmat_type), intent(in) :: map_X2Y, map_Y2X
|
||||
integer, intent(in) :: map_kind
|
||||
integer, intent(in), optional :: iaggr(:), naggr(:)
|
||||
end function psb_d_linmap
|
||||
function psb_c_linmap(map_kind,desc_X, desc_Y, map_X2Y, map_Y2X,iaggr,naggr)
|
||||
use psb_linmap_type_mod
|
||||
implicit none
|
||||
type(psb_clinmap_type) :: psb_c_linmap
|
||||
type(psb_desc_type), target :: desc_X, desc_Y
|
||||
type(psb_cspmat_type), intent(in) :: map_X2Y, map_Y2X
|
||||
integer, intent(in) :: map_kind
|
||||
integer, intent(in), optional :: iaggr(:), naggr(:)
|
||||
end function psb_c_linmap
|
||||
function psb_z_linmap(map_kind,desc_X, desc_Y, map_X2Y, map_Y2X,iaggr,naggr)
|
||||
use psb_linmap_type_mod
|
||||
implicit none
|
||||
type(psb_zlinmap_type) :: psb_z_linmap
|
||||
type(psb_desc_type), target :: desc_X, desc_Y
|
||||
type(psb_zspmat_type), intent(in) :: map_X2Y, map_Y2X
|
||||
integer, intent(in) :: map_kind
|
||||
integer, intent(in), optional :: iaggr(:), naggr(:)
|
||||
end function psb_z_linmap
|
||||
end interface
|
||||
|
||||
interface psb_sizeof
|
||||
module procedure psb_slinmap_sizeof, psb_dlinmap_sizeof, &
|
||||
& psb_clinmap_sizeof, psb_zlinmap_sizeof
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
function psb_get_smap_kind(map)
|
||||
implicit none
|
||||
type(psb_slinmap_type), intent(in) :: map
|
||||
Integer :: psb_get_smap_kind
|
||||
if (allocated(map%itd_data)) then
|
||||
psb_get_smap_kind = map%itd_data(psb_map_kind_)
|
||||
else
|
||||
psb_get_smap_kind = -1
|
||||
end if
|
||||
end function psb_get_smap_kind
|
||||
|
||||
function psb_get_dmap_kind(map)
|
||||
implicit none
|
||||
type(psb_dlinmap_type), intent(in) :: map
|
||||
Integer :: psb_get_dmap_kind
|
||||
if (allocated(map%itd_data)) then
|
||||
psb_get_dmap_kind = map%itd_data(psb_map_kind_)
|
||||
else
|
||||
psb_get_dmap_kind = -1
|
||||
end if
|
||||
end function psb_get_dmap_kind
|
||||
function psb_get_cmap_kind(map)
|
||||
implicit none
|
||||
type(psb_clinmap_type), intent(in) :: map
|
||||
Integer :: psb_get_cmap_kind
|
||||
if (allocated(map%itd_data)) then
|
||||
psb_get_cmap_kind = map%itd_data(psb_map_kind_)
|
||||
else
|
||||
psb_get_cmap_kind = -1
|
||||
end if
|
||||
end function psb_get_cmap_kind
|
||||
function psb_get_zmap_kind(map)
|
||||
implicit none
|
||||
type(psb_zlinmap_type), intent(in) :: map
|
||||
Integer :: psb_get_zmap_kind
|
||||
if (allocated(map%itd_data)) then
|
||||
psb_get_zmap_kind = map%itd_data(psb_map_kind_)
|
||||
else
|
||||
psb_get_zmap_kind = -1
|
||||
end if
|
||||
end function psb_get_zmap_kind
|
||||
|
||||
subroutine psb_set_smap_kind(map_kind,map)
|
||||
implicit none
|
||||
integer, intent(in) :: map_kind
|
||||
type(psb_slinmap_type), intent(inout) :: map
|
||||
|
||||
map%itd_data(psb_map_kind_) = map_kind
|
||||
|
||||
end subroutine psb_set_smap_kind
|
||||
subroutine psb_set_dmap_kind(map_kind,map)
|
||||
implicit none
|
||||
integer, intent(in) :: map_kind
|
||||
type(psb_dlinmap_type), intent(inout) :: map
|
||||
|
||||
map%itd_data(psb_map_kind_) = map_kind
|
||||
|
||||
end subroutine psb_set_dmap_kind
|
||||
subroutine psb_set_cmap_kind(map_kind,map)
|
||||
implicit none
|
||||
integer, intent(in) :: map_kind
|
||||
type(psb_clinmap_type), intent(inout) :: map
|
||||
|
||||
map%itd_data(psb_map_kind_) = map_kind
|
||||
|
||||
end subroutine psb_set_cmap_kind
|
||||
subroutine psb_set_zmap_kind(map_kind,map)
|
||||
implicit none
|
||||
integer, intent(in) :: map_kind
|
||||
type(psb_zlinmap_type), intent(inout) :: map
|
||||
|
||||
map%itd_data(psb_map_kind_) = map_kind
|
||||
|
||||
end subroutine psb_set_zmap_kind
|
||||
|
||||
|
||||
function psb_is_asb_slinmap(map) result(this)
|
||||
implicit none
|
||||
type(psb_slinmap_type), intent(in) :: map
|
||||
logical :: this
|
||||
|
||||
this = .false.
|
||||
if (.not.allocated(map%itd_data)) return
|
||||
select case(psb_get_map_kind(map))
|
||||
case (psb_map_aggr_)
|
||||
if (.not.associated(map%p_desc_X)) return
|
||||
if (.not.associated(map%p_desc_Y)) return
|
||||
this = &
|
||||
& psb_is_asb_desc(map%p_desc_X).and.psb_is_asb_desc(map%p_desc_Y)
|
||||
|
||||
case(psb_map_gen_linear_)
|
||||
|
||||
this = &
|
||||
& psb_is_asb_desc(map%desc_X).and.psb_is_asb_desc(map%desc_Y)
|
||||
|
||||
end select
|
||||
|
||||
end function psb_is_asb_slinmap
|
||||
|
||||
function psb_is_asb_dlinmap(map) result(this)
|
||||
implicit none
|
||||
type(psb_dlinmap_type), intent(in) :: map
|
||||
logical :: this
|
||||
|
||||
this = .false.
|
||||
if (.not.allocated(map%itd_data)) return
|
||||
select case(psb_get_map_kind(map))
|
||||
case (psb_map_aggr_)
|
||||
if (.not.associated(map%p_desc_X)) return
|
||||
if (.not.associated(map%p_desc_Y)) return
|
||||
this = &
|
||||
& psb_is_asb_desc(map%p_desc_X).and.psb_is_asb_desc(map%p_desc_Y)
|
||||
|
||||
case(psb_map_gen_linear_)
|
||||
|
||||
this = &
|
||||
& psb_is_asb_desc(map%desc_X).and.psb_is_asb_desc(map%desc_Y)
|
||||
|
||||
end select
|
||||
|
||||
end function psb_is_asb_dlinmap
|
||||
|
||||
function psb_is_asb_clinmap(map) result(this)
|
||||
implicit none
|
||||
type(psb_clinmap_type), intent(in) :: map
|
||||
logical :: this
|
||||
|
||||
this = .false.
|
||||
if (.not.allocated(map%itd_data)) return
|
||||
select case(psb_get_map_kind(map))
|
||||
case (psb_map_aggr_)
|
||||
if (.not.associated(map%p_desc_X)) return
|
||||
if (.not.associated(map%p_desc_Y)) return
|
||||
this = &
|
||||
& psb_is_asb_desc(map%p_desc_X).and.psb_is_asb_desc(map%p_desc_Y)
|
||||
|
||||
case(psb_map_gen_linear_)
|
||||
|
||||
this = &
|
||||
& psb_is_asb_desc(map%desc_X).and.psb_is_asb_desc(map%desc_Y)
|
||||
|
||||
end select
|
||||
|
||||
end function psb_is_asb_clinmap
|
||||
|
||||
function psb_is_asb_zlinmap(map) result(this)
|
||||
implicit none
|
||||
type(psb_zlinmap_type), intent(in) :: map
|
||||
logical :: this
|
||||
|
||||
this = .false.
|
||||
if (.not.allocated(map%itd_data)) return
|
||||
select case(psb_get_map_kind(map))
|
||||
case (psb_map_aggr_)
|
||||
if (.not.associated(map%p_desc_X)) return
|
||||
if (.not.associated(map%p_desc_Y)) return
|
||||
this = &
|
||||
& psb_is_asb_desc(map%p_desc_X).and.psb_is_asb_desc(map%p_desc_Y)
|
||||
|
||||
case(psb_map_gen_linear_)
|
||||
|
||||
this = &
|
||||
& psb_is_asb_desc(map%desc_X).and.psb_is_asb_desc(map%desc_Y)
|
||||
|
||||
end select
|
||||
|
||||
end function psb_is_asb_zlinmap
|
||||
|
||||
function psb_is_ok_slinmap(map) result(this)
|
||||
implicit none
|
||||
type(psb_slinmap_type), intent(in) :: map
|
||||
logical :: this
|
||||
this = .false.
|
||||
if (.not.allocated(map%itd_data)) return
|
||||
select case(psb_get_map_kind(map))
|
||||
case (psb_map_aggr_)
|
||||
if (.not.associated(map%p_desc_X)) return
|
||||
if (.not.associated(map%p_desc_Y)) return
|
||||
this = &
|
||||
& psb_is_ok_desc(map%p_desc_X).and.psb_is_ok_desc(map%p_desc_Y)
|
||||
case(psb_map_gen_linear_)
|
||||
this = &
|
||||
& psb_is_ok_desc(map%desc_X).and.psb_is_ok_desc(map%desc_Y)
|
||||
end select
|
||||
|
||||
end function psb_is_ok_slinmap
|
||||
|
||||
function psb_is_ok_dlinmap(map) result(this)
|
||||
implicit none
|
||||
type(psb_dlinmap_type), intent(in) :: map
|
||||
logical :: this
|
||||
this = .false.
|
||||
if (.not.allocated(map%itd_data)) return
|
||||
select case(psb_get_map_kind(map))
|
||||
case (psb_map_aggr_)
|
||||
if (.not.associated(map%p_desc_X)) return
|
||||
if (.not.associated(map%p_desc_Y)) return
|
||||
this = &
|
||||
& psb_is_ok_desc(map%p_desc_X).and.psb_is_ok_desc(map%p_desc_Y)
|
||||
case(psb_map_gen_linear_)
|
||||
this = &
|
||||
& psb_is_ok_desc(map%desc_X).and.psb_is_ok_desc(map%desc_Y)
|
||||
end select
|
||||
|
||||
end function psb_is_ok_dlinmap
|
||||
|
||||
function psb_is_ok_clinmap(map) result(this)
|
||||
implicit none
|
||||
type(psb_clinmap_type), intent(in) :: map
|
||||
logical :: this
|
||||
this = .false.
|
||||
if (.not.allocated(map%itd_data)) return
|
||||
select case(psb_get_map_kind(map))
|
||||
case (psb_map_aggr_)
|
||||
if (.not.associated(map%p_desc_X)) return
|
||||
if (.not.associated(map%p_desc_Y)) return
|
||||
this = &
|
||||
& psb_is_ok_desc(map%p_desc_X).and.psb_is_ok_desc(map%p_desc_Y)
|
||||
case(psb_map_gen_linear_)
|
||||
this = &
|
||||
& psb_is_ok_desc(map%desc_X).and.psb_is_ok_desc(map%desc_Y)
|
||||
end select
|
||||
|
||||
end function psb_is_ok_clinmap
|
||||
|
||||
function psb_is_ok_zlinmap(map) result(this)
|
||||
implicit none
|
||||
type(psb_zlinmap_type), intent(in) :: map
|
||||
logical :: this
|
||||
this = .false.
|
||||
if (.not.allocated(map%itd_data)) return
|
||||
select case(psb_get_map_kind(map))
|
||||
case (psb_map_aggr_)
|
||||
if (.not.associated(map%p_desc_X)) return
|
||||
if (.not.associated(map%p_desc_Y)) return
|
||||
this = &
|
||||
& psb_is_ok_desc(map%p_desc_X).and.psb_is_ok_desc(map%p_desc_Y)
|
||||
case(psb_map_gen_linear_)
|
||||
this = &
|
||||
& psb_is_ok_desc(map%desc_X).and.psb_is_ok_desc(map%desc_Y)
|
||||
end select
|
||||
|
||||
end function psb_is_ok_zlinmap
|
||||
|
||||
|
||||
function psb_slinmap_sizeof(map) result(val)
|
||||
implicit none
|
||||
type(psb_slinmap_type), intent(in) :: map
|
||||
integer(psb_long_int_k_) :: val
|
||||
|
||||
val = 0
|
||||
if (allocated(map%itd_data)) &
|
||||
& val = val + psb_sizeof_int*size(map%itd_data)
|
||||
if (allocated(map%iaggr)) &
|
||||
& val = val + psb_sizeof_int*size(map%iaggr)
|
||||
if (allocated(map%naggr)) &
|
||||
& val = val + psb_sizeof_int*size(map%naggr)
|
||||
val = val + psb_sizeof(map%desc_X)
|
||||
val = val + psb_sizeof(map%desc_Y)
|
||||
val = val + psb_sizeof(map%map_X2Y)
|
||||
val = val + psb_sizeof(map%map_Y2X)
|
||||
|
||||
end function psb_slinmap_sizeof
|
||||
|
||||
function psb_dlinmap_sizeof(map) result(val)
|
||||
implicit none
|
||||
type(psb_dlinmap_type), intent(in) :: map
|
||||
integer(psb_long_int_k_) :: val
|
||||
|
||||
val = 0
|
||||
if (allocated(map%itd_data)) &
|
||||
& val = val + psb_sizeof_int*size(map%itd_data)
|
||||
if (allocated(map%iaggr)) &
|
||||
& val = val + psb_sizeof_int*size(map%iaggr)
|
||||
if (allocated(map%naggr)) &
|
||||
& val = val + psb_sizeof_int*size(map%naggr)
|
||||
val = val + psb_sizeof(map%desc_X)
|
||||
val = val + psb_sizeof(map%desc_Y)
|
||||
val = val + psb_sizeof(map%map_X2Y)
|
||||
val = val + psb_sizeof(map%map_Y2X)
|
||||
|
||||
end function psb_dlinmap_sizeof
|
||||
|
||||
function psb_clinmap_sizeof(map) result(val)
|
||||
implicit none
|
||||
type(psb_clinmap_type), intent(in) :: map
|
||||
integer(psb_long_int_k_) :: val
|
||||
|
||||
val = 0
|
||||
if (allocated(map%itd_data)) &
|
||||
& val = val + psb_sizeof_int*size(map%itd_data)
|
||||
if (allocated(map%iaggr)) &
|
||||
& val = val + psb_sizeof_int*size(map%iaggr)
|
||||
if (allocated(map%naggr)) &
|
||||
& val = val + psb_sizeof_int*size(map%naggr)
|
||||
val = val + psb_sizeof(map%desc_X)
|
||||
val = val + psb_sizeof(map%desc_Y)
|
||||
val = val + psb_sizeof(map%map_X2Y)
|
||||
val = val + psb_sizeof(map%map_Y2X)
|
||||
|
||||
end function psb_clinmap_sizeof
|
||||
|
||||
function psb_zlinmap_sizeof(map) result(val)
|
||||
implicit none
|
||||
type(psb_zlinmap_type), intent(in) :: map
|
||||
integer(psb_long_int_k_) :: val
|
||||
|
||||
val = 0
|
||||
if (allocated(map%itd_data)) &
|
||||
& val = val + psb_sizeof_int*size(map%itd_data)
|
||||
if (allocated(map%iaggr)) &
|
||||
& val = val + psb_sizeof_int*size(map%iaggr)
|
||||
if (allocated(map%naggr)) &
|
||||
& val = val + psb_sizeof_int*size(map%naggr)
|
||||
val = val + psb_sizeof(map%desc_X)
|
||||
val = val + psb_sizeof(map%desc_Y)
|
||||
val = val + psb_sizeof(map%map_X2Y)
|
||||
val = val + psb_sizeof(map%map_Y2X)
|
||||
|
||||
end function psb_zlinmap_sizeof
|
||||
|
||||
|
||||
subroutine psb_s_linmap_sub(out_map,map_kind,desc_X, desc_Y, map_X2Y, map_Y2X,iaggr,naggr)
|
||||
use psb_linmap_type_mod
|
||||
implicit none
|
||||
type(psb_slinmap_type), intent(out) :: out_map
|
||||
type(psb_desc_type), target :: desc_X, desc_Y
|
||||
type(psb_sspmat_type), intent(in) :: map_X2Y, map_Y2X
|
||||
integer, intent(in) :: map_kind
|
||||
integer, intent(in), optional :: iaggr(:), naggr(:)
|
||||
out_map = psb_linmap(map_kind,desc_X,desc_Y,map_X2Y,map_Y2X,iaggr,naggr)
|
||||
end subroutine psb_s_linmap_sub
|
||||
|
||||
subroutine psb_d_linmap_sub(out_map,map_kind,desc_X, desc_Y, map_X2Y, map_Y2X,iaggr,naggr)
|
||||
use psb_linmap_type_mod
|
||||
implicit none
|
||||
type(psb_dlinmap_type), intent(out) :: out_map
|
||||
type(psb_desc_type), target :: desc_X, desc_Y
|
||||
type(psb_dspmat_type), intent(in) :: map_X2Y, map_Y2X
|
||||
integer, intent(in) :: map_kind
|
||||
integer, intent(in), optional :: iaggr(:), naggr(:)
|
||||
out_map = psb_linmap(map_kind,desc_X,desc_Y,map_X2Y,map_Y2X,iaggr,naggr)
|
||||
end subroutine psb_d_linmap_sub
|
||||
|
||||
subroutine psb_c_linmap_sub(out_map,map_kind,desc_X, desc_Y, map_X2Y, map_Y2X,iaggr,naggr)
|
||||
use psb_linmap_type_mod
|
||||
implicit none
|
||||
type(psb_clinmap_type), intent(out) :: out_map
|
||||
type(psb_desc_type), target :: desc_X, desc_Y
|
||||
type(psb_cspmat_type), intent(in) :: map_X2Y, map_Y2X
|
||||
integer, intent(in) :: map_kind
|
||||
integer, intent(in), optional :: iaggr(:), naggr(:)
|
||||
out_map = psb_linmap(map_kind,desc_X,desc_Y,map_X2Y,map_Y2X,iaggr,naggr)
|
||||
end subroutine psb_c_linmap_sub
|
||||
|
||||
subroutine psb_z_linmap_sub(out_map,map_kind,desc_X, desc_Y, map_X2Y, map_Y2X,iaggr,naggr)
|
||||
use psb_linmap_type_mod
|
||||
implicit none
|
||||
type(psb_zlinmap_type), intent(out) :: out_map
|
||||
type(psb_desc_type), target :: desc_X, desc_Y
|
||||
type(psb_zspmat_type), intent(in) :: map_X2Y, map_Y2X
|
||||
integer, intent(in) :: map_kind
|
||||
integer, intent(in), optional :: iaggr(:), naggr(:)
|
||||
out_map = psb_linmap(map_kind,desc_X,desc_Y,map_X2Y,map_Y2X,iaggr,naggr)
|
||||
end subroutine psb_z_linmap_sub
|
||||
|
||||
|
||||
subroutine psb_slinmap_transfer(mapin,mapout,info)
|
||||
use psb_spmat_type
|
||||
use psb_descriptor_type
|
||||
implicit none
|
||||
type(psb_slinmap_type) :: mapin,mapout
|
||||
integer, intent(out) :: info
|
||||
|
||||
call psb_move_alloc(mapin%itd_data,mapout%itd_data,info)
|
||||
call psb_move_alloc(mapin%iaggr,mapout%iaggr,info)
|
||||
call psb_move_alloc(mapin%naggr,mapout%naggr,info)
|
||||
mapout%p_desc_X => mapin%p_desc_X
|
||||
mapin%p_desc_X => null()
|
||||
mapout%p_desc_Y => mapin%p_desc_Y
|
||||
mapin%p_desc_Y => null()
|
||||
call psb_move_alloc(mapin%desc_X,mapout%desc_X,info)
|
||||
call psb_move_alloc(mapin%desc_Y,mapout%desc_Y,info)
|
||||
call psb_move_alloc(mapin%map_X2Y,mapout%map_X2Y,info)
|
||||
call psb_move_alloc(mapin%map_Y2X,mapout%map_Y2X,info)
|
||||
|
||||
end subroutine psb_slinmap_transfer
|
||||
|
||||
subroutine psb_dlinmap_transfer(mapin,mapout,info)
|
||||
use psb_spmat_type
|
||||
use psb_descriptor_type
|
||||
implicit none
|
||||
type(psb_dlinmap_type) :: mapin,mapout
|
||||
integer, intent(out) :: info
|
||||
|
||||
call psb_move_alloc(mapin%itd_data,mapout%itd_data,info)
|
||||
call psb_move_alloc(mapin%iaggr,mapout%iaggr,info)
|
||||
call psb_move_alloc(mapin%naggr,mapout%naggr,info)
|
||||
mapout%p_desc_X => mapin%p_desc_X
|
||||
mapin%p_desc_X => null()
|
||||
mapout%p_desc_Y => mapin%p_desc_Y
|
||||
mapin%p_desc_Y => null()
|
||||
call psb_move_alloc(mapin%desc_X,mapout%desc_X,info)
|
||||
call psb_move_alloc(mapin%desc_Y,mapout%desc_Y,info)
|
||||
call psb_move_alloc(mapin%map_X2Y,mapout%map_X2Y,info)
|
||||
call psb_move_alloc(mapin%map_Y2X,mapout%map_Y2X,info)
|
||||
|
||||
end subroutine psb_dlinmap_transfer
|
||||
|
||||
subroutine psb_clinmap_transfer(mapin,mapout,info)
|
||||
use psb_spmat_type
|
||||
use psb_descriptor_type
|
||||
implicit none
|
||||
type(psb_clinmap_type) :: mapin,mapout
|
||||
integer, intent(out) :: info
|
||||
|
||||
call psb_move_alloc(mapin%itd_data,mapout%itd_data,info)
|
||||
call psb_move_alloc(mapin%iaggr,mapout%iaggr,info)
|
||||
call psb_move_alloc(mapin%naggr,mapout%naggr,info)
|
||||
mapout%p_desc_X => mapin%p_desc_X
|
||||
mapin%p_desc_X => null()
|
||||
mapout%p_desc_Y => mapin%p_desc_Y
|
||||
mapin%p_desc_Y => null()
|
||||
call psb_move_alloc(mapin%desc_X,mapout%desc_X,info)
|
||||
call psb_move_alloc(mapin%desc_Y,mapout%desc_Y,info)
|
||||
call psb_move_alloc(mapin%map_X2Y,mapout%map_X2Y,info)
|
||||
call psb_move_alloc(mapin%map_Y2X,mapout%map_Y2X,info)
|
||||
|
||||
end subroutine psb_clinmap_transfer
|
||||
|
||||
subroutine psb_zlinmap_transfer(mapin,mapout,info)
|
||||
use psb_spmat_type
|
||||
use psb_descriptor_type
|
||||
implicit none
|
||||
type(psb_zlinmap_type) :: mapin,mapout
|
||||
integer, intent(out) :: info
|
||||
|
||||
call psb_move_alloc(mapin%itd_data,mapout%itd_data,info)
|
||||
call psb_move_alloc(mapin%iaggr,mapout%iaggr,info)
|
||||
call psb_move_alloc(mapin%naggr,mapout%naggr,info)
|
||||
mapout%p_desc_X => mapin%p_desc_X
|
||||
mapin%p_desc_X => null()
|
||||
mapout%p_desc_Y => mapin%p_desc_Y
|
||||
mapin%p_desc_Y => null()
|
||||
call psb_move_alloc(mapin%desc_X,mapout%desc_X,info)
|
||||
call psb_move_alloc(mapin%desc_Y,mapout%desc_Y,info)
|
||||
call psb_move_alloc(mapin%map_X2Y,mapout%map_X2Y,info)
|
||||
call psb_move_alloc(mapin%map_Y2X,mapout%map_Y2X,info)
|
||||
|
||||
end subroutine psb_zlinmap_transfer
|
||||
|
||||
|
||||
end module psb_linmap_mod
|
@ -0,0 +1,86 @@
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 2.2
|
||||
!!$ (C) Copyright 2006/2007/2008
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari University of Rome Tor Vergata
|
||||
!!$
|
||||
!!$ 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_linmap_type_mod
|
||||
! Defines data types for mapping between vectors belonging
|
||||
! to different spaces.
|
||||
!
|
||||
module psb_linmap_type_mod
|
||||
use psb_spmat_type, only : psb_sspmat_type, psb_dspmat_type, &
|
||||
& psb_cspmat_type, psb_zspmat_type, psb_spk_, psb_dpk_, psb_sizeof
|
||||
|
||||
use psb_descriptor_type, only: psb_desc_type
|
||||
|
||||
|
||||
! Inter-descriptor mapping data structures.
|
||||
integer, parameter :: psb_map_kind_ = 1
|
||||
integer, parameter :: psb_map_data_ = 2
|
||||
integer, parameter :: psb_map_integer_ = 1
|
||||
integer, parameter :: psb_map_single_ = 2
|
||||
integer, parameter :: psb_map_double_ = 3
|
||||
integer, parameter :: psb_map_complex_ = 4
|
||||
integer, parameter :: psb_map_double_complex_ = 5
|
||||
|
||||
integer, parameter :: psb_itd_data_size_=20
|
||||
|
||||
|
||||
type psb_slinmap_type
|
||||
integer, allocatable :: itd_data(:), iaggr(:), naggr(:)
|
||||
type(psb_desc_type), pointer :: p_desc_X=>null(), p_desc_Y=>null()
|
||||
type(psb_desc_type) :: desc_X, desc_Y
|
||||
type(psb_sspmat_type) :: map_X2Y, map_Y2X
|
||||
end type psb_slinmap_type
|
||||
|
||||
type psb_dlinmap_type
|
||||
integer, allocatable :: itd_data(:), iaggr(:), naggr(:)
|
||||
type(psb_desc_type), pointer :: p_desc_X=>null(), p_desc_Y=>null()
|
||||
type(psb_desc_type) :: desc_X, desc_Y
|
||||
type(psb_dspmat_type) :: map_X2Y, map_Y2X
|
||||
end type psb_dlinmap_type
|
||||
|
||||
type psb_clinmap_type
|
||||
integer, allocatable :: itd_data(:), iaggr(:), naggr(:)
|
||||
type(psb_desc_type), pointer :: p_desc_X=>null(), p_desc_Y=>null()
|
||||
type(psb_desc_type) :: desc_X, desc_Y
|
||||
type(psb_cspmat_type) :: map_X2Y, map_Y2X
|
||||
end type psb_clinmap_type
|
||||
|
||||
type psb_zlinmap_type
|
||||
integer, allocatable :: itd_data(:), iaggr(:), naggr(:)
|
||||
type(psb_desc_type), pointer :: p_desc_X=>null(), p_desc_Y=>null()
|
||||
type(psb_desc_type) :: desc_X, desc_Y
|
||||
type(psb_zspmat_type) :: map_X2Y, map_Y2X
|
||||
end type psb_zlinmap_type
|
||||
|
||||
end module psb_linmap_type_mod
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,408 +0,0 @@
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 2.2
|
||||
!!$ (C) Copyright 2006/2007/2008
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari University of Rome Tor Vergata
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
function psb_c_inter_desc(map_kind,desc1, desc2, map_fw, map_bk, idx_fw, idx_bk)
|
||||
|
||||
use psb_base_mod, psb_protect_name => psb_c_inter_desc
|
||||
|
||||
implicit none
|
||||
type(psb_inter_desc_type) :: psb_c_inter_desc
|
||||
type(psb_desc_type), target :: desc1, desc2
|
||||
type(psb_cspmat_type), intent(in) :: map_fw, map_bk
|
||||
integer, intent(in) :: map_kind,idx_fw(:), idx_bk(:)
|
||||
!
|
||||
type(psb_inter_desc_type) :: this
|
||||
integer :: info
|
||||
character(len=20), parameter :: name='psb_inter_desc'
|
||||
|
||||
info = 0
|
||||
if (psb_is_ok_desc(desc1)) then
|
||||
this%desc_1=>desc1
|
||||
else
|
||||
info = 2
|
||||
endif
|
||||
if (psb_is_ok_desc(desc2)) then
|
||||
this%desc_2=>desc2
|
||||
else
|
||||
info = 3
|
||||
endif
|
||||
|
||||
if (info == 0) call psb_sp_clone(map_fw,this%cmap%map_fw,info)
|
||||
if (info == 0) call psb_sp_clone(map_bk,this%cmap%map_bk,info)
|
||||
if (info == 0) call psb_safe_cpy(idx_fw,this%exch_fw_idx,info)
|
||||
if (info == 0) call psb_safe_cpy(idx_bk,this%exch_bk_idx,info)
|
||||
if (info == 0) call psb_realloc(psb_itd_data_size_,this%itd_data,info)
|
||||
if (info == 0) then
|
||||
call psb_cd_set_map_kind(map_kind, this)
|
||||
call psb_cd_set_map_data(psb_map_complex_, this)
|
||||
end if
|
||||
if (info /= 0) then
|
||||
write(0,*) trim(name),' Invalid descriptor input'
|
||||
return
|
||||
end if
|
||||
|
||||
psb_c_inter_desc = this
|
||||
|
||||
end function psb_c_inter_desc
|
||||
|
||||
|
||||
function psb_c_inter_desc_noidx(map_kind,desc1, desc2, map_fw, map_bk)
|
||||
|
||||
use psb_base_mod, psb_protect_name => psb_c_inter_desc_noidx
|
||||
|
||||
implicit none
|
||||
type(psb_inter_desc_type) :: psb_c_inter_desc_noidx
|
||||
type(psb_desc_type), target :: desc1, desc2
|
||||
type(psb_cspmat_type), intent(in) :: map_fw, map_bk
|
||||
integer, intent(in) :: map_kind
|
||||
!
|
||||
type(psb_inter_desc_type) :: this
|
||||
integer :: info
|
||||
character(len=20), parameter :: name='psb_inter_desc'
|
||||
|
||||
info = 0
|
||||
select case(map_kind)
|
||||
case (psb_map_aggr_)
|
||||
! OK
|
||||
case default
|
||||
write(0,*) 'Bad map kind into psb_inter_desc ',map_kind
|
||||
info = 1
|
||||
end select
|
||||
|
||||
if (psb_is_ok_desc(desc1)) then
|
||||
this%desc_1=>desc1
|
||||
else
|
||||
info = 2
|
||||
endif
|
||||
if (psb_is_ok_desc(desc2)) then
|
||||
this%desc_2=>desc2
|
||||
else
|
||||
info = 3
|
||||
endif
|
||||
|
||||
if (info == 0) call psb_sp_clone(map_fw,this%cmap%map_fw,info)
|
||||
if (info == 0) call psb_sp_clone(map_bk,this%cmap%map_bk,info)
|
||||
if (info == 0) call psb_realloc(psb_itd_data_size_,this%itd_data,info)
|
||||
if (info == 0) then
|
||||
call psb_cd_set_map_kind(map_kind, this)
|
||||
call psb_cd_set_map_data(psb_map_complex_, this)
|
||||
end if
|
||||
if (info /= 0) then
|
||||
write(0,*) trim(name),' Invalid descriptor input'
|
||||
return
|
||||
end if
|
||||
|
||||
psb_c_inter_desc_noidx = this
|
||||
|
||||
end function psb_c_inter_desc_noidx
|
||||
|
||||
function psb_d_inter_desc(map_kind,desc1,desc2,map_fw,map_bk,idx_fw,idx_bk)
|
||||
|
||||
use psb_base_mod, psb_protect_name => psb_d_inter_desc
|
||||
|
||||
implicit none
|
||||
type(psb_inter_desc_type) :: psb_d_inter_desc
|
||||
type(psb_desc_type), target :: desc1, desc2
|
||||
type(psb_dspmat_type), intent(in) :: map_fw, map_bk
|
||||
integer, intent(in) :: map_kind,idx_fw(:), idx_bk(:)
|
||||
!
|
||||
type(psb_inter_desc_type) :: this
|
||||
integer :: info
|
||||
character(len=20), parameter :: name='psb_inter_desc'
|
||||
|
||||
info = 0
|
||||
if (psb_is_ok_desc(desc1)) then
|
||||
this%desc_1=>desc1
|
||||
else
|
||||
info = 2
|
||||
endif
|
||||
if (psb_is_ok_desc(desc2)) then
|
||||
this%desc_2=>desc2
|
||||
else
|
||||
info = 3
|
||||
endif
|
||||
|
||||
if (info == 0) call psb_sp_clone(map_fw,this%dmap%map_fw,info)
|
||||
if (info == 0) call psb_sp_clone(map_bk,this%dmap%map_bk,info)
|
||||
if (info == 0) call psb_safe_cpy(idx_fw,this%exch_fw_idx,info)
|
||||
if (info == 0) call psb_safe_cpy(idx_bk,this%exch_bk_idx,info)
|
||||
if (info == 0) call psb_realloc(psb_itd_data_size_,this%itd_data,info)
|
||||
if (info == 0) then
|
||||
call psb_cd_set_map_kind(map_kind, this)
|
||||
call psb_cd_set_map_data(psb_map_double_, this)
|
||||
end if
|
||||
if (info /= 0) then
|
||||
write(0,*) trim(name),' Invalid descriptor input'
|
||||
return
|
||||
end if
|
||||
|
||||
psb_d_inter_desc = this
|
||||
|
||||
end function psb_d_inter_desc
|
||||
|
||||
function psb_d_inter_desc_noidx(map_kind,desc1, desc2, map_fw, map_bk)
|
||||
|
||||
use psb_base_mod, psb_protect_name => psb_d_inter_desc_noidx
|
||||
|
||||
implicit none
|
||||
type(psb_inter_desc_type) :: psb_d_inter_desc_noidx
|
||||
type(psb_desc_type), target :: desc1, desc2
|
||||
type(psb_dspmat_type), intent(in) :: map_fw, map_bk
|
||||
integer, intent(in) :: map_kind
|
||||
!
|
||||
type(psb_inter_desc_type) :: this
|
||||
integer :: info
|
||||
character(len=20), parameter :: name='psb_inter_desc'
|
||||
|
||||
info = 0
|
||||
select case(map_kind)
|
||||
case (psb_map_aggr_)
|
||||
! OK
|
||||
case default
|
||||
write(0,*) 'Bad map kind into psb_inter_desc ',map_kind
|
||||
info = 1
|
||||
end select
|
||||
|
||||
if (psb_is_ok_desc(desc1)) then
|
||||
this%desc_1=>desc1
|
||||
else
|
||||
info = 2
|
||||
endif
|
||||
if (psb_is_ok_desc(desc2)) then
|
||||
this%desc_2=>desc2
|
||||
else
|
||||
info = 3
|
||||
endif
|
||||
|
||||
if (info == 0) call psb_sp_clone(map_fw,this%dmap%map_fw,info)
|
||||
if (info == 0) call psb_sp_clone(map_bk,this%dmap%map_bk,info)
|
||||
if (info == 0) call psb_realloc(psb_itd_data_size_,this%itd_data,info)
|
||||
if (info == 0) then
|
||||
call psb_cd_set_map_kind(map_kind, this)
|
||||
call psb_cd_set_map_data(psb_map_double_, this)
|
||||
end if
|
||||
if (info /= 0) then
|
||||
write(0,*) trim(name),' Invalid descriptor input'
|
||||
return
|
||||
end if
|
||||
|
||||
psb_d_inter_desc_noidx = this
|
||||
|
||||
end function psb_d_inter_desc_noidx
|
||||
|
||||
|
||||
function psb_s_inter_desc(map_kind,desc1,desc2,map_fw,map_bk,idx_fw,idx_bk)
|
||||
|
||||
use psb_base_mod, psb_protect_name => psb_s_inter_desc
|
||||
|
||||
implicit none
|
||||
type(psb_inter_desc_type) :: psb_s_inter_desc
|
||||
type(psb_desc_type), target :: desc1, desc2
|
||||
type(psb_sspmat_type), intent(in) :: map_fw, map_bk
|
||||
integer, intent(in) :: map_kind,idx_fw(:), idx_bk(:)
|
||||
!
|
||||
type(psb_inter_desc_type) :: this
|
||||
integer :: info
|
||||
character(len=20), parameter :: name='psb_inter_desc'
|
||||
|
||||
info = 0
|
||||
if (psb_is_ok_desc(desc1)) then
|
||||
this%desc_1=>desc1
|
||||
else
|
||||
info = 2
|
||||
endif
|
||||
if (psb_is_ok_desc(desc2)) then
|
||||
this%desc_2=>desc2
|
||||
else
|
||||
info = 3
|
||||
endif
|
||||
|
||||
if (info == 0) call psb_sp_clone(map_fw,this%smap%map_fw,info)
|
||||
if (info == 0) call psb_sp_clone(map_bk,this%smap%map_bk,info)
|
||||
if (info == 0) call psb_safe_cpy(idx_fw,this%exch_fw_idx,info)
|
||||
if (info == 0) call psb_safe_cpy(idx_bk,this%exch_bk_idx,info)
|
||||
if (info == 0) call psb_realloc(psb_itd_data_size_,this%itd_data,info)
|
||||
if (info == 0) then
|
||||
call psb_cd_set_map_kind(map_kind, this)
|
||||
call psb_cd_set_map_data(psb_map_single_, this)
|
||||
end if
|
||||
if (info /= 0) then
|
||||
write(0,*) trim(name),' Invalid descriptor input'
|
||||
return
|
||||
end if
|
||||
|
||||
psb_s_inter_desc = this
|
||||
|
||||
end function psb_s_inter_desc
|
||||
|
||||
function psb_s_inter_desc_noidx(map_kind,desc1, desc2, map_fw, map_bk)
|
||||
|
||||
use psb_base_mod, psb_protect_name => psb_s_inter_desc_noidx
|
||||
|
||||
implicit none
|
||||
type(psb_inter_desc_type) :: psb_s_inter_desc_noidx
|
||||
type(psb_desc_type), target :: desc1, desc2
|
||||
type(psb_sspmat_type), intent(in) :: map_fw, map_bk
|
||||
integer, intent(in) :: map_kind
|
||||
!
|
||||
type(psb_inter_desc_type) :: this
|
||||
integer :: info
|
||||
character(len=20), parameter :: name='psb_inter_desc'
|
||||
|
||||
info = 0
|
||||
select case(map_kind)
|
||||
case (psb_map_aggr_)
|
||||
! OK
|
||||
case default
|
||||
write(0,*) 'Bad map kind into psb_inter_desc ',map_kind
|
||||
info = 1
|
||||
end select
|
||||
|
||||
if (psb_is_ok_desc(desc1)) then
|
||||
this%desc_1=>desc1
|
||||
else
|
||||
info = 2
|
||||
endif
|
||||
if (psb_is_ok_desc(desc2)) then
|
||||
this%desc_2=>desc2
|
||||
else
|
||||
info = 3
|
||||
endif
|
||||
|
||||
if (info == 0) call psb_sp_clone(map_fw,this%smap%map_fw,info)
|
||||
if (info == 0) call psb_sp_clone(map_bk,this%smap%map_bk,info)
|
||||
if (info == 0) call psb_realloc(psb_itd_data_size_,this%itd_data,info)
|
||||
if (info == 0) then
|
||||
call psb_cd_set_map_kind(map_kind, this)
|
||||
call psb_cd_set_map_data(psb_map_single_, this)
|
||||
end if
|
||||
if (info /= 0) then
|
||||
write(0,*) trim(name),' Invalid descriptor input'
|
||||
return
|
||||
end if
|
||||
|
||||
psb_s_inter_desc_noidx = this
|
||||
|
||||
end function psb_s_inter_desc_noidx
|
||||
|
||||
function psb_z_inter_desc(map_kind,desc1, desc2, map_fw, map_bk, idx_fw, idx_bk)
|
||||
|
||||
use psb_base_mod, psb_protect_name => psb_z_inter_desc
|
||||
|
||||
implicit none
|
||||
type(psb_inter_desc_type) :: psb_z_inter_desc
|
||||
type(psb_desc_type), target :: desc1, desc2
|
||||
type(psb_zspmat_type), intent(in) :: map_fw, map_bk
|
||||
integer, intent(in) :: map_kind,idx_fw(:), idx_bk(:)
|
||||
!
|
||||
type(psb_inter_desc_type) :: this
|
||||
integer :: info
|
||||
character(len=20), parameter :: name='psb_inter_desc'
|
||||
|
||||
info = 0
|
||||
if (psb_is_ok_desc(desc1)) then
|
||||
this%desc_1=>desc1
|
||||
else
|
||||
info = 2
|
||||
endif
|
||||
if (psb_is_ok_desc(desc2)) then
|
||||
this%desc_2=>desc2
|
||||
else
|
||||
info = 3
|
||||
endif
|
||||
|
||||
if (info == 0) call psb_sp_clone(map_fw,this%zmap%map_fw,info)
|
||||
if (info == 0) call psb_sp_clone(map_bk,this%zmap%map_bk,info)
|
||||
if (info == 0) call psb_safe_cpy(idx_fw,this%exch_fw_idx,info)
|
||||
if (info == 0) call psb_safe_cpy(idx_bk,this%exch_bk_idx,info)
|
||||
if (info == 0) call psb_realloc(psb_itd_data_size_,this%itd_data,info)
|
||||
if (info == 0) then
|
||||
call psb_cd_set_map_kind(map_kind, this)
|
||||
call psb_cd_set_map_data(psb_map_double_complex_, this)
|
||||
end if
|
||||
if (info /= 0) then
|
||||
write(0,*) trim(name),' Invalid descriptor input'
|
||||
return
|
||||
end if
|
||||
|
||||
psb_z_inter_desc = this
|
||||
|
||||
end function psb_z_inter_desc
|
||||
|
||||
function psb_z_inter_desc_noidx(map_kind,desc1, desc2, map_fw, map_bk)
|
||||
|
||||
use psb_base_mod, psb_protect_name => psb_z_inter_desc_noidx
|
||||
|
||||
implicit none
|
||||
type(psb_inter_desc_type) :: psb_z_inter_desc_noidx
|
||||
type(psb_desc_type), target :: desc1, desc2
|
||||
type(psb_zspmat_type), intent(in) :: map_fw, map_bk
|
||||
integer, intent(in) :: map_kind
|
||||
!
|
||||
type(psb_inter_desc_type) :: this
|
||||
integer :: info
|
||||
character(len=20), parameter :: name='psb_inter_desc'
|
||||
|
||||
info = 0
|
||||
select case(map_kind)
|
||||
case (psb_map_aggr_)
|
||||
! OK
|
||||
case default
|
||||
write(0,*) 'Bad map kind into psb_inter_desc ',map_kind
|
||||
info = 1
|
||||
end select
|
||||
|
||||
if (psb_is_ok_desc(desc1)) then
|
||||
this%desc_1=>desc1
|
||||
else
|
||||
info = 2
|
||||
endif
|
||||
if (psb_is_ok_desc(desc2)) then
|
||||
this%desc_2=>desc2
|
||||
else
|
||||
info = 3
|
||||
endif
|
||||
|
||||
if (info == 0) call psb_sp_clone(map_fw,this%zmap%map_fw,info)
|
||||
if (info == 0) call psb_sp_clone(map_bk,this%zmap%map_bk,info)
|
||||
if (info == 0) call psb_realloc(psb_itd_data_size_,this%itd_data,info)
|
||||
if (info == 0) then
|
||||
call psb_cd_set_map_kind(map_kind, this)
|
||||
call psb_cd_set_map_data(psb_map_double_complex_, this)
|
||||
end if
|
||||
if (info /= 0) then
|
||||
write(0,*) trim(name),' Invalid descriptor input'
|
||||
return
|
||||
end if
|
||||
|
||||
psb_z_inter_desc_noidx = this
|
||||
|
||||
end function psb_z_inter_desc_noidx
|
@ -0,0 +1,345 @@
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 2.2
|
||||
!!$ (C) Copyright 2006/2007/2008
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari University of Rome Tor Vergata
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
|
||||
function psb_c_linmap(map_kind,desc_X, desc_Y, map_X2Y, map_Y2X,iaggr,naggr) result(this)
|
||||
|
||||
use psb_base_mod, psb_protect_name => psb_c_linmap
|
||||
|
||||
implicit none
|
||||
type(psb_clinmap_type) :: this
|
||||
type(psb_desc_type), target :: desc_X, desc_Y
|
||||
type(psb_cspmat_type), intent(in) :: map_X2Y, map_Y2X
|
||||
integer, intent(in) :: map_kind
|
||||
integer, intent(in), optional :: iaggr(:), naggr(:)
|
||||
!
|
||||
integer :: info
|
||||
character(len=20), parameter :: name='psb_linmap'
|
||||
|
||||
info = 0
|
||||
select case(map_kind)
|
||||
case (psb_map_aggr_)
|
||||
! OK
|
||||
if (psb_is_ok_desc(desc_X)) then
|
||||
this%p_desc_X=>desc_X
|
||||
else
|
||||
info = 2
|
||||
endif
|
||||
if (psb_is_ok_desc(desc_Y)) then
|
||||
this%p_desc_Y=>desc_Y
|
||||
else
|
||||
info = 3
|
||||
endif
|
||||
if (present(iaggr)) then
|
||||
if (.not.present(naggr)) then
|
||||
info = 7
|
||||
else
|
||||
allocate(this%iaggr(size(iaggr)),&
|
||||
& this%naggr(size(naggr)), stat=info)
|
||||
if (info == 0) then
|
||||
this%iaggr = iaggr
|
||||
this%naggr = naggr
|
||||
end if
|
||||
end if
|
||||
else
|
||||
allocate(this%iaggr(0), this%naggr(0), stat=info)
|
||||
end if
|
||||
|
||||
case(psb_map_gen_linear_)
|
||||
|
||||
if (psb_is_ok_desc(desc_X)) then
|
||||
call psb_cdcpy(desc_X, this%desc_X,info)
|
||||
else
|
||||
info = 2
|
||||
endif
|
||||
if (psb_is_ok_desc(desc_Y)) then
|
||||
call psb_cdcpy(desc_Y, this%desc_Y,info)
|
||||
else
|
||||
info = 3
|
||||
endif
|
||||
! For a general linear map ignore iaggr,naggr
|
||||
allocate(this%iaggr(0), this%naggr(0), stat=info)
|
||||
|
||||
case default
|
||||
write(0,*) 'Bad map kind into psb_linmap ',map_kind
|
||||
info = 1
|
||||
end select
|
||||
|
||||
if (info == 0) call psb_sp_clone(map_X2Y,this%map_X2Y,info)
|
||||
if (info == 0) call psb_sp_clone(map_Y2X,this%map_Y2X,info)
|
||||
if (info == 0) call psb_realloc(psb_itd_data_size_,this%itd_data,info)
|
||||
if (info == 0) then
|
||||
call psb_set_map_kind(map_kind, this)
|
||||
end if
|
||||
if (info /= 0) then
|
||||
write(0,*) trim(name),' Invalid descriptor input'
|
||||
return
|
||||
end if
|
||||
|
||||
end function psb_c_linmap
|
||||
|
||||
function psb_d_linmap(map_kind,desc_X, desc_Y, map_X2Y, map_Y2X,iaggr,naggr) result(this)
|
||||
|
||||
use psb_base_mod, psb_protect_name => psb_d_linmap
|
||||
|
||||
implicit none
|
||||
type(psb_dlinmap_type) :: this
|
||||
type(psb_desc_type), target :: desc_X, desc_Y
|
||||
type(psb_dspmat_type), intent(in) :: map_X2Y, map_Y2X
|
||||
integer, intent(in) :: map_kind
|
||||
integer, intent(in), optional :: iaggr(:), naggr(:)
|
||||
!
|
||||
integer :: info
|
||||
character(len=20), parameter :: name='psb_linmap'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
info = 0
|
||||
select case(map_kind)
|
||||
case (psb_map_aggr_)
|
||||
! OK
|
||||
|
||||
if (psb_is_ok_desc(desc_X)) then
|
||||
this%p_desc_X=>desc_X
|
||||
else
|
||||
info = 2
|
||||
endif
|
||||
if (psb_is_ok_desc(desc_Y)) then
|
||||
this%p_desc_Y=>desc_Y
|
||||
else
|
||||
info = 3
|
||||
endif
|
||||
if (present(iaggr)) then
|
||||
if (.not.present(naggr)) then
|
||||
info = 7
|
||||
else
|
||||
allocate(this%iaggr(size(iaggr)),&
|
||||
& this%naggr(size(naggr)), stat=info)
|
||||
if (info == 0) then
|
||||
this%iaggr = iaggr
|
||||
this%naggr = naggr
|
||||
end if
|
||||
end if
|
||||
else
|
||||
allocate(this%iaggr(0), this%naggr(0), stat=info)
|
||||
end if
|
||||
|
||||
case(psb_map_gen_linear_)
|
||||
|
||||
if (psb_is_ok_desc(desc_X)) then
|
||||
call psb_cdcpy(desc_X, this%desc_X,info)
|
||||
else
|
||||
info = 2
|
||||
endif
|
||||
if (psb_is_ok_desc(desc_Y)) then
|
||||
call psb_cdcpy(desc_Y, this%desc_Y,info)
|
||||
else
|
||||
info = 3
|
||||
endif
|
||||
! For a general linear map ignore iaggr,naggr
|
||||
allocate(this%iaggr(0), this%naggr(0), stat=info)
|
||||
|
||||
case default
|
||||
write(0,*) 'Bad map kind into psb_linmap ',map_kind
|
||||
info = 1
|
||||
end select
|
||||
|
||||
if (info == 0) call psb_sp_clone(map_X2Y,this%map_X2Y,info)
|
||||
if (info == 0) call psb_sp_clone(map_Y2X,this%map_Y2X,info)
|
||||
if (info == 0) call psb_realloc(psb_itd_data_size_,this%itd_data,info)
|
||||
if (info == 0) then
|
||||
call psb_set_map_kind(map_kind, this)
|
||||
end if
|
||||
if (info /= 0) then
|
||||
write(0,*) trim(name),' Invalid descriptor input'
|
||||
return
|
||||
end if
|
||||
if (debug) then
|
||||
write(0,*) trim(name),' forward map:',allocated(this%map_X2Y%aspk)
|
||||
write(0,*) trim(name),' backward map:',allocated(this%map_Y2X%aspk)
|
||||
end if
|
||||
|
||||
end function psb_d_linmap
|
||||
|
||||
function psb_s_linmap(map_kind,desc_X, desc_Y, map_X2Y, map_Y2X,iaggr,naggr) result(this)
|
||||
|
||||
use psb_base_mod, psb_protect_name => psb_s_linmap
|
||||
|
||||
implicit none
|
||||
type(psb_slinmap_type) :: this
|
||||
type(psb_desc_type), target :: desc_X, desc_Y
|
||||
type(psb_sspmat_type), intent(in) :: map_X2Y, map_Y2X
|
||||
integer, intent(in) :: map_kind
|
||||
integer, intent(in), optional :: iaggr(:), naggr(:)
|
||||
!
|
||||
integer :: info
|
||||
character(len=20), parameter :: name='psb_linmap'
|
||||
|
||||
info = 0
|
||||
|
||||
select case(map_kind)
|
||||
case (psb_map_aggr_)
|
||||
! OK
|
||||
|
||||
if (psb_is_ok_desc(desc_X)) then
|
||||
this%p_desc_X=>desc_X
|
||||
else
|
||||
info = 2
|
||||
endif
|
||||
if (psb_is_ok_desc(desc_Y)) then
|
||||
this%p_desc_Y=>desc_Y
|
||||
else
|
||||
info = 3
|
||||
endif
|
||||
if (present(iaggr)) then
|
||||
if (.not.present(naggr)) then
|
||||
info = 7
|
||||
else
|
||||
allocate(this%iaggr(size(iaggr)),&
|
||||
& this%naggr(size(naggr)), stat=info)
|
||||
if (info == 0) then
|
||||
this%iaggr = iaggr
|
||||
this%naggr = naggr
|
||||
end if
|
||||
end if
|
||||
else
|
||||
allocate(this%iaggr(0), this%naggr(0), stat=info)
|
||||
end if
|
||||
|
||||
case(psb_map_gen_linear_)
|
||||
|
||||
if (psb_is_ok_desc(desc_X)) then
|
||||
call psb_cdcpy(desc_X, this%desc_X,info)
|
||||
else
|
||||
info = 2
|
||||
endif
|
||||
if (psb_is_ok_desc(desc_Y)) then
|
||||
call psb_cdcpy(desc_Y, this%desc_Y,info)
|
||||
else
|
||||
info = 3
|
||||
endif
|
||||
! For a general linear map ignore iaggr,naggr
|
||||
allocate(this%iaggr(0), this%naggr(0), stat=info)
|
||||
|
||||
case default
|
||||
write(0,*) 'Bad map kind into psb_linmap ',map_kind
|
||||
info = 1
|
||||
end select
|
||||
|
||||
|
||||
if (info == 0) call psb_sp_clone(map_X2Y,this%map_X2Y,info)
|
||||
if (info == 0) call psb_sp_clone(map_Y2X,this%map_Y2X,info)
|
||||
if (info == 0) call psb_realloc(psb_itd_data_size_,this%itd_data,info)
|
||||
if (info == 0) then
|
||||
call psb_set_map_kind(map_kind, this)
|
||||
end if
|
||||
if (info /= 0) then
|
||||
write(0,*) trim(name),' Invalid descriptor input'
|
||||
return
|
||||
end if
|
||||
|
||||
end function psb_s_linmap
|
||||
|
||||
function psb_z_linmap(map_kind,desc_X, desc_Y, map_X2Y, map_Y2X,iaggr,naggr) result(this)
|
||||
|
||||
use psb_base_mod, psb_protect_name => psb_z_linmap
|
||||
|
||||
implicit none
|
||||
type(psb_zlinmap_type) :: this
|
||||
type(psb_desc_type), target :: desc_X, desc_Y
|
||||
type(psb_zspmat_type), intent(in) :: map_X2Y, map_Y2X
|
||||
integer, intent(in) :: map_kind
|
||||
integer, intent(in), optional :: iaggr(:), naggr(:)
|
||||
!
|
||||
integer :: info
|
||||
character(len=20), parameter :: name='psb_linmap'
|
||||
|
||||
info = 0
|
||||
select case(map_kind)
|
||||
case (psb_map_aggr_)
|
||||
! OK
|
||||
|
||||
if (psb_is_ok_desc(desc_X)) then
|
||||
this%p_desc_X=>desc_X
|
||||
else
|
||||
info = 2
|
||||
endif
|
||||
if (psb_is_ok_desc(desc_Y)) then
|
||||
this%p_desc_Y=>desc_Y
|
||||
else
|
||||
info = 3
|
||||
endif
|
||||
if (present(iaggr)) then
|
||||
if (.not.present(naggr)) then
|
||||
info = 7
|
||||
else
|
||||
allocate(this%iaggr(size(iaggr)),&
|
||||
& this%naggr(size(naggr)), stat=info)
|
||||
if (info == 0) then
|
||||
this%iaggr = iaggr
|
||||
this%naggr = naggr
|
||||
end if
|
||||
end if
|
||||
else
|
||||
allocate(this%iaggr(0), this%naggr(0), stat=info)
|
||||
end if
|
||||
|
||||
case(psb_map_gen_linear_)
|
||||
|
||||
if (psb_is_ok_desc(desc_X)) then
|
||||
call psb_cdcpy(desc_X, this%desc_X,info)
|
||||
else
|
||||
info = 2
|
||||
endif
|
||||
if (psb_is_ok_desc(desc_Y)) then
|
||||
call psb_cdcpy(desc_Y, this%desc_Y,info)
|
||||
else
|
||||
info = 3
|
||||
endif
|
||||
! For a general linear map ignore iaggr,naggr
|
||||
allocate(this%iaggr(0), this%naggr(0), stat=info)
|
||||
|
||||
case default
|
||||
write(0,*) 'Bad map kind into psb_linmap ',map_kind
|
||||
info = 1
|
||||
end select
|
||||
|
||||
if (info == 0) call psb_sp_clone(map_X2Y,this%map_X2Y,info)
|
||||
if (info == 0) call psb_sp_clone(map_Y2X,this%map_Y2X,info)
|
||||
if (info == 0) call psb_realloc(psb_itd_data_size_,this%itd_data,info)
|
||||
if (info == 0) then
|
||||
call psb_set_map_kind(map_kind, this)
|
||||
end if
|
||||
if (info /= 0) then
|
||||
write(0,*) trim(name),' Invalid descriptor input'
|
||||
return
|
||||
end if
|
||||
|
||||
end function psb_z_linmap
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue