From a50ce17bcb31d0cf0a2dc1e3b512a24e7ba17aee Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Sun, 31 Mar 2013 17:38:02 +0000 Subject: [PATCH] psblas3: base/modules/psb_base_linmap_mod.f90 base/modules/psb_c_linmap_mod.f90 base/modules/psb_d_linmap_mod.f90 base/modules/psb_s_linmap_mod.f90 base/modules/psb_z_linmap_mod.f90 Defined and fixed clone method. --- base/modules/psb_base_linmap_mod.f90 | 23 ++++++++++++++++++++++- base/modules/psb_c_linmap_mod.f90 | 17 +++++++++-------- base/modules/psb_d_linmap_mod.f90 | 17 +++++++++-------- base/modules/psb_s_linmap_mod.f90 | 17 +++++++++-------- base/modules/psb_z_linmap_mod.f90 | 17 +++++++++-------- 5 files changed, 58 insertions(+), 33 deletions(-) diff --git a/base/modules/psb_base_linmap_mod.f90 b/base/modules/psb_base_linmap_mod.f90 index f8373500..8b0d2bf1 100644 --- a/base/modules/psb_base_linmap_mod.f90 +++ b/base/modules/psb_base_linmap_mod.f90 @@ -52,6 +52,7 @@ module psb_base_linmap_mod procedure, pass(map) :: get_kind => base_get_kind procedure, pass(map) :: set_kind => base_set_kind procedure, pass(map) :: free => base_free + procedure, pass(map) :: clone => base_clone end type psb_base_linmap_type @@ -60,7 +61,7 @@ module psb_base_linmap_mod end interface private :: base_map_sizeof, base_is_ok, base_is_asb,& - & base_get_kind, base_set_kind, base_free + & base_get_kind, base_set_kind, base_free, base_clone contains @@ -155,6 +156,26 @@ contains end subroutine psb_base_linmap_transfer + + + subroutine base_clone(map,mapout,info) + use psb_desc_mod + implicit none + class(psb_base_linmap_type), intent(inout) :: map + class(psb_base_linmap_type), intent(out) :: mapout + integer(psb_ipk_) :: info + + mapout%kind = map%kind + call psb_safe_ab_copy(map%iaggr,mapout%iaggr,info) + call psb_safe_ab_copy(map%naggr,mapout%naggr,info) + mapout%p_desc_X => map%p_desc_X + mapout%p_desc_Y => map%p_desc_Y + call map%desc_X%clone(mapout%desc_X,info) + call map%desc_Y%clone(mapout%desc_Y,info) + + end subroutine base_clone + + subroutine base_free(map,info) implicit none class(psb_base_linmap_type) :: map diff --git a/base/modules/psb_c_linmap_mod.f90 b/base/modules/psb_c_linmap_mod.f90 index 20ff7729..af3ee151 100644 --- a/base/modules/psb_c_linmap_mod.f90 +++ b/base/modules/psb_c_linmap_mod.f90 @@ -46,10 +46,10 @@ module psb_c_linmap_mod type, extends(psb_base_linmap_type) :: psb_clinmap_type type(psb_cspmat_type) :: map_X2Y, map_Y2X contains - procedure, pass(map) :: sizeof => c_map_sizeof - procedure, pass(map) :: is_asb => c_is_asb - procedure, pass(map) :: free => c_free - procedure, pass(mapin) :: clone => c_clone + procedure, pass(map) :: sizeof => c_map_sizeof + procedure, pass(map) :: is_asb => c_is_asb + procedure, pass(map) :: free => c_free + procedure, pass(map) :: clone => c_clone end type psb_clinmap_type @@ -214,16 +214,17 @@ contains end subroutine c_free - subroutine c_clone(mapin,mapout) + subroutine c_clone(map,mapout,info) use psb_desc_mod implicit none - class(psb_clinmap_type), intent(inout) :: mapin + class(psb_clinmap_type), intent(inout) :: map class(psb_clinmap_type), intent(out) :: mapout integer(psb_ipk_) :: info ! Base clone! - call mapin%map_X2Y%clone(mapout%map_X2Y,info) - call mapin%map_Y2X%clone(mapout%map_Y2X,info) + call map%psb_base_linmap_type%clone(mapout%psb_base_linmap_type,info) + call map%map_X2Y%clone(mapout%map_X2Y,info) + call map%map_Y2X%clone(mapout%map_Y2X,info) end subroutine c_clone diff --git a/base/modules/psb_d_linmap_mod.f90 b/base/modules/psb_d_linmap_mod.f90 index a6dd33ad..bdb1b3dd 100644 --- a/base/modules/psb_d_linmap_mod.f90 +++ b/base/modules/psb_d_linmap_mod.f90 @@ -46,10 +46,10 @@ module psb_d_linmap_mod type, extends(psb_base_linmap_type) :: psb_dlinmap_type type(psb_dspmat_type) :: map_X2Y, map_Y2X contains - procedure, pass(map) :: sizeof => d_map_sizeof - procedure, pass(map) :: is_asb => d_is_asb - procedure, pass(map) :: free => d_free - procedure, pass(mapin) :: clone => d_clone + procedure, pass(map) :: sizeof => d_map_sizeof + procedure, pass(map) :: is_asb => d_is_asb + procedure, pass(map) :: free => d_free + procedure, pass(map) :: clone => d_clone end type psb_dlinmap_type @@ -214,16 +214,17 @@ contains end subroutine d_free - subroutine d_clone(mapin,mapout) + subroutine d_clone(map,mapout,info) use psb_desc_mod implicit none - class(psb_dlinmap_type), intent(inout) :: mapin + class(psb_dlinmap_type), intent(inout) :: map class(psb_dlinmap_type), intent(out) :: mapout integer(psb_ipk_) :: info ! Base clone! - call mapin%map_X2Y%clone(mapout%map_X2Y,info) - call mapin%map_Y2X%clone(mapout%map_Y2X,info) + call map%psb_base_linmap_type%clone(mapout%psb_base_linmap_type,info) + call map%map_X2Y%clone(mapout%map_X2Y,info) + call map%map_Y2X%clone(mapout%map_Y2X,info) end subroutine d_clone diff --git a/base/modules/psb_s_linmap_mod.f90 b/base/modules/psb_s_linmap_mod.f90 index 3554abf0..c0a52418 100644 --- a/base/modules/psb_s_linmap_mod.f90 +++ b/base/modules/psb_s_linmap_mod.f90 @@ -46,10 +46,10 @@ module psb_s_linmap_mod type, extends(psb_base_linmap_type) :: psb_slinmap_type type(psb_sspmat_type) :: map_X2Y, map_Y2X contains - procedure, pass(map) :: sizeof => s_map_sizeof - procedure, pass(map) :: is_asb => s_is_asb - procedure, pass(map) :: free => s_free - procedure, pass(mapin) :: clone => s_clone + procedure, pass(map) :: sizeof => s_map_sizeof + procedure, pass(map) :: is_asb => s_is_asb + procedure, pass(map) :: free => s_free + procedure, pass(map) :: clone => s_clone end type psb_slinmap_type @@ -214,16 +214,17 @@ contains end subroutine s_free - subroutine s_clone(mapin,mapout) + subroutine s_clone(map,mapout,info) use psb_desc_mod implicit none - class(psb_slinmap_type), intent(inout) :: mapin + class(psb_slinmap_type), intent(inout) :: map class(psb_slinmap_type), intent(out) :: mapout integer(psb_ipk_) :: info ! Base clone! - call mapin%map_X2Y%clone(mapout%map_X2Y,info) - call mapin%map_Y2X%clone(mapout%map_Y2X,info) + call map%psb_base_linmap_type%clone(mapout%psb_base_linmap_type,info) + call map%map_X2Y%clone(mapout%map_X2Y,info) + call map%map_Y2X%clone(mapout%map_Y2X,info) end subroutine s_clone diff --git a/base/modules/psb_z_linmap_mod.f90 b/base/modules/psb_z_linmap_mod.f90 index e84949c7..34bcc05d 100644 --- a/base/modules/psb_z_linmap_mod.f90 +++ b/base/modules/psb_z_linmap_mod.f90 @@ -46,10 +46,10 @@ module psb_z_linmap_mod type, extends(psb_base_linmap_type) :: psb_zlinmap_type type(psb_zspmat_type) :: map_X2Y, map_Y2X contains - procedure, pass(map) :: sizeof => z_map_sizeof - procedure, pass(map) :: is_asb => z_is_asb - procedure, pass(map) :: free => z_free - procedure, pass(mapin) :: clone => z_clone + procedure, pass(map) :: sizeof => z_map_sizeof + procedure, pass(map) :: is_asb => z_is_asb + procedure, pass(map) :: free => z_free + procedure, pass(map) :: clone => z_clone end type psb_zlinmap_type @@ -214,16 +214,17 @@ contains end subroutine z_free - subroutine z_clone(mapin,mapout) + subroutine z_clone(map,mapout,info) use psb_desc_mod implicit none - class(psb_zlinmap_type), intent(inout) :: mapin + class(psb_zlinmap_type), intent(inout) :: map class(psb_zlinmap_type), intent(out) :: mapout integer(psb_ipk_) :: info ! Base clone! - call mapin%map_X2Y%clone(mapout%map_X2Y,info) - call mapin%map_Y2X%clone(mapout%map_Y2X,info) + call map%psb_base_linmap_type%clone(mapout%psb_base_linmap_type,info) + call map%map_X2Y%clone(mapout%map_X2Y,info) + call map%map_Y2X%clone(mapout%map_Y2X,info) end subroutine z_clone