From 98088ecf0e875eb0541ed5ca4764278a7dfa03e1 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Wed, 27 Jul 2011 09:23:14 +0000 Subject: [PATCH] psblas3: base/modules/psb_c_mat_mod.f90 base/modules/psb_d_mat_mod.f90 base/modules/psb_s_mat_mod.f90 base/modules/psb_z_mat_mod.f90 base/serial/impl/psb_c_mat_impl.F90 base/serial/impl/psb_d_mat_impl.F90 base/serial/impl/psb_s_mat_impl.F90 base/serial/impl/psb_z_mat_impl.F90 util/psb_d_renum_impl.F90 util/psb_renum_mod.f90 psblas3: defined MOLD method for _SPMAT_TYPE containers. --- base/modules/psb_c_mat_mod.f90 | 12 ++++++++++-- base/modules/psb_d_mat_mod.f90 | 21 +++++++++------------ base/modules/psb_s_mat_mod.f90 | 12 ++++++++++-- base/modules/psb_z_mat_mod.f90 | 10 +++++++++- base/serial/impl/psb_c_mat_impl.F90 | 13 ++++++++++++- base/serial/impl/psb_d_mat_impl.F90 | 13 ++++++++++++- base/serial/impl/psb_s_mat_impl.F90 | 13 ++++++++++++- base/serial/impl/psb_z_mat_impl.F90 | 13 ++++++++++++- util/psb_d_renum_impl.F90 | 3 ++- util/psb_renum_mod.f90 | 1 - 10 files changed, 88 insertions(+), 23 deletions(-) diff --git a/base/modules/psb_c_mat_mod.f90 b/base/modules/psb_c_mat_mod.f90 index 2892a967..bf1a001c 100644 --- a/base/modules/psb_c_mat_mod.f90 +++ b/base/modules/psb_c_mat_mod.f90 @@ -121,6 +121,7 @@ module psb_c_mat_mod generic, public :: cp_from => c_cp_from procedure, pass(a) :: c_cp_to => psb_c_cp_to generic, public :: cp_to => c_cp_to + procedure, pass(a) :: mold => psb_c_mold procedure, pass(a) :: c_transp_1mat => psb_c_transp_1mat procedure, pass(a) :: c_transp_2mat => psb_c_transp_2mat generic, public :: transp => c_transp_1mat, c_transp_2mat @@ -514,7 +515,6 @@ module psb_c_mat_mod end subroutine psb_cspmat_type_move end interface - interface psb_clone subroutine psb_cspmat_type_clone(a,b,info) import :: psb_cspmat_type @@ -523,7 +523,15 @@ module psb_c_mat_mod integer, intent(out) :: info end subroutine psb_cspmat_type_clone end interface - + + interface + subroutine psb_c_mold(a,b) + import :: psb_cspmat_type, psb_c_base_sparse_mat + class(psb_cspmat_type), intent(inout) :: a + class(psb_c_base_sparse_mat), allocatable, intent(out) :: b + end subroutine psb_c_mold + end interface + interface subroutine psb_c_transp_1mat(a) import :: psb_cspmat_type diff --git a/base/modules/psb_d_mat_mod.f90 b/base/modules/psb_d_mat_mod.f90 index 82062b24..226dcd31 100644 --- a/base/modules/psb_d_mat_mod.f90 +++ b/base/modules/psb_d_mat_mod.f90 @@ -120,7 +120,7 @@ module psb_d_mat_mod generic, public :: cp_from => d_cp_from procedure, pass(a) :: d_cp_to => psb_d_cp_to generic, public :: cp_to => d_cp_to - procedure, pass(a) :: extract => psb_d_extract + procedure, pass(a) :: mold => psb_d_mold procedure, pass(a) :: d_transp_1mat => psb_d_transp_1mat procedure, pass(a) :: d_transp_2mat => psb_d_transp_2mat generic, public :: transp => d_transp_1mat, d_transp_2mat @@ -519,7 +519,6 @@ module psb_d_mat_mod end subroutine psb_dspmat_type_move end interface - interface psb_clone subroutine psb_dspmat_type_clone(a,b,info) import :: psb_dspmat_type @@ -529,6 +528,14 @@ module psb_d_mat_mod end subroutine psb_dspmat_type_clone end interface + interface + subroutine psb_d_mold(a,b) + import :: psb_dspmat_type, psb_d_base_sparse_mat + class(psb_dspmat_type), intent(inout) :: a + class(psb_d_base_sparse_mat), allocatable, intent(out) :: b + end subroutine psb_d_mold + end interface + interface subroutine psb_d_transp_1mat(a) import :: psb_dspmat_type @@ -700,8 +707,6 @@ module psb_d_mat_mod end interface - - contains @@ -956,12 +961,4 @@ contains end function psb_d_get_nz_row - subroutine psb_d_extract(a,b) - implicit none - class(psb_dspmat_type), intent(inout) :: a - class(psb_d_base_sparse_mat), allocatable, intent(out) :: b - - call move_alloc(a%a,b) - end subroutine psb_d_extract - end module psb_d_mat_mod diff --git a/base/modules/psb_s_mat_mod.f90 b/base/modules/psb_s_mat_mod.f90 index c5b96700..497ee367 100644 --- a/base/modules/psb_s_mat_mod.f90 +++ b/base/modules/psb_s_mat_mod.f90 @@ -121,6 +121,7 @@ module psb_s_mat_mod generic, public :: cp_from => s_cp_from procedure, pass(a) :: s_cp_to => psb_s_cp_to generic, public :: cp_to => s_cp_to + procedure, pass(a) :: mold => psb_s_mold procedure, pass(a) :: s_transp_1mat => psb_s_transp_1mat procedure, pass(a) :: s_transp_2mat => psb_s_transp_2mat generic, public :: transp => s_transp_1mat, s_transp_2mat @@ -512,8 +513,7 @@ module psb_s_mat_mod class(psb_sspmat_type), intent(out) :: b integer, intent(out) :: info end subroutine psb_sspmat_type_move - end interface - + end interface psb_move_alloc interface psb_clone subroutine psb_sspmat_type_clone(a,b,info) @@ -524,6 +524,14 @@ module psb_s_mat_mod end subroutine psb_sspmat_type_clone end interface + interface + subroutine psb_s_mold(a,b) + import :: psb_sspmat_type, psb_s_base_sparse_mat + class(psb_sspmat_type), intent(inout) :: a + class(psb_s_base_sparse_mat), allocatable, intent(out) :: b + end subroutine psb_s_mold + end interface + interface subroutine psb_s_transp_1mat(a) import :: psb_sspmat_type diff --git a/base/modules/psb_z_mat_mod.f90 b/base/modules/psb_z_mat_mod.f90 index bbc02541..fe3b4a38 100644 --- a/base/modules/psb_z_mat_mod.f90 +++ b/base/modules/psb_z_mat_mod.f90 @@ -121,6 +121,7 @@ module psb_z_mat_mod generic, public :: cp_from => z_cp_from procedure, pass(a) :: z_cp_to => psb_z_cp_to generic, public :: cp_to => z_cp_to + procedure, pass(a) :: mold => psb_z_mold procedure, pass(a) :: z_transp_1mat => psb_z_transp_1mat procedure, pass(a) :: z_transp_2mat => psb_z_transp_2mat generic, public :: transp => z_transp_1mat, z_transp_2mat @@ -513,7 +514,6 @@ module psb_z_mat_mod end subroutine psb_zspmat_type_move end interface - interface psb_clone subroutine psb_zspmat_type_clone(a,b,info) import :: psb_zspmat_type @@ -522,6 +522,14 @@ module psb_z_mat_mod integer, intent(out) :: info end subroutine psb_zspmat_type_clone end interface + + interface + subroutine psb_z_mold(a,b) + import :: psb_zspmat_type, psb_z_base_sparse_mat + class(psb_zspmat_type), intent(inout) :: a + class(psb_z_base_sparse_mat), allocatable, intent(out) :: b + end subroutine psb_z_mold + end interface interface subroutine psb_z_transp_1mat(a) diff --git a/base/serial/impl/psb_c_mat_impl.F90 b/base/serial/impl/psb_c_mat_impl.F90 index d1e9c012..3df591bf 100644 --- a/base/serial/impl/psb_c_mat_impl.F90 +++ b/base/serial/impl/psb_c_mat_impl.F90 @@ -1474,7 +1474,18 @@ subroutine psb_c_cp_to(a,b) return end subroutine psb_c_cp_to - +subroutine psb_c_mold(a,b) + use psb_c_mat_mod, psb_protect_name => psb_c_mold + class(psb_cspmat_type), intent(inout) :: a + class(psb_c_base_sparse_mat), allocatable, intent(out) :: b + integer :: info +#if defined(HAVE_MOLD) + allocate(b,mold=a%a, stat=info) +#else + call a%a%mold(b,info) +#endif + +end subroutine psb_c_mold subroutine psb_cspmat_type_move(a,b,info) use psb_error_mod diff --git a/base/serial/impl/psb_d_mat_impl.F90 b/base/serial/impl/psb_d_mat_impl.F90 index b6d36abb..1804495e 100644 --- a/base/serial/impl/psb_d_mat_impl.F90 +++ b/base/serial/impl/psb_d_mat_impl.F90 @@ -1474,7 +1474,18 @@ subroutine psb_d_cp_to(a,b) return end subroutine psb_d_cp_to - +subroutine psb_d_mold(a,b) + use psb_d_mat_mod, psb_protect_name => psb_d_mold + class(psb_dspmat_type), intent(inout) :: a + class(psb_d_base_sparse_mat), allocatable, intent(out) :: b + integer :: info +#if defined(HAVE_MOLD) + allocate(b,mold=a%a, stat=info) +#else + call a%a%mold(b,info) +#endif + +end subroutine psb_d_mold subroutine psb_dspmat_type_move(a,b,info) use psb_error_mod diff --git a/base/serial/impl/psb_s_mat_impl.F90 b/base/serial/impl/psb_s_mat_impl.F90 index c804e2dd..32778472 100644 --- a/base/serial/impl/psb_s_mat_impl.F90 +++ b/base/serial/impl/psb_s_mat_impl.F90 @@ -1472,7 +1472,18 @@ subroutine psb_s_cp_to(a,b) return end subroutine psb_s_cp_to - +subroutine psb_s_mold(a,b) + use psb_s_mat_mod, psb_protect_name => psb_s_mold + class(psb_sspmat_type), intent(inout) :: a + class(psb_s_base_sparse_mat), allocatable, intent(out) :: b + integer :: info +#if defined(HAVE_MOLD) + allocate(b,mold=a%a, stat=info) +#else + call a%a%mold(b,info) +#endif + +end subroutine psb_s_mold subroutine psb_sspmat_type_move(a,b,info) use psb_error_mod diff --git a/base/serial/impl/psb_z_mat_impl.F90 b/base/serial/impl/psb_z_mat_impl.F90 index 66fb8d16..716c5e35 100644 --- a/base/serial/impl/psb_z_mat_impl.F90 +++ b/base/serial/impl/psb_z_mat_impl.F90 @@ -1473,7 +1473,18 @@ subroutine psb_z_cp_to(a,b) return end subroutine psb_z_cp_to - +subroutine psb_z_mold(a,b) + use psb_z_mat_mod, psb_protect_name => psb_z_mold + class(psb_zspmat_type), intent(inout) :: a + class(psb_z_base_sparse_mat), allocatable, intent(out) :: b + integer :: info +#if defined(HAVE_MOLD) + allocate(b,mold=a%a, stat=info) +#else + call a%a%mold(b,info) +#endif + +end subroutine psb_z_mold subroutine psb_zspmat_type_move(a,b,info) use psb_error_mod diff --git a/util/psb_d_renum_impl.F90 b/util/psb_d_renum_impl.F90 index 17da6973..9827a51e 100644 --- a/util/psb_d_renum_impl.F90 +++ b/util/psb_d_renum_impl.F90 @@ -65,7 +65,8 @@ contains info = psb_success_ - call a%extract(aa) + call a%mold(aa) + call a%mv_to(aa) call aa%mv_to_fmt(acsr,info) ! Insert call to gps_reduce diff --git a/util/psb_renum_mod.f90 b/util/psb_renum_mod.f90 index 4b8058b1..77fc6f2b 100644 --- a/util/psb_renum_mod.f90 +++ b/util/psb_renum_mod.f90 @@ -13,5 +13,4 @@ module psb_renum_mod end subroutine psb_d_mat_renum end interface psb_mat_renum - end module psb_renum_mod