base/modules/psb_d_linmap_mod.f90
 base/modules/psb_linmap_type_mod.f90

Defined sizeof() as a method of MAP objects. 
Should we rework the whole structure of MAPs and make them
polymorphic? Probably yes...
psblas3-type-indexed
Salvatore Filippone 13 years ago
parent 63991f24ab
commit f80e8ecd7c

@ -220,18 +220,19 @@ contains
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)
!!$ 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)
val = map%sizeof()
end function psb_dlinmap_sizeof
subroutine psb_d_linmap_sub(out_map,map_kind,desc_X, desc_Y,&

@ -59,6 +59,8 @@ module psb_linmap_type_mod
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
contains
procedure, pass(map) :: sizeof => s_map_sizeof
end type psb_slinmap_type
type psb_dlinmap_type
@ -66,6 +68,8 @@ module psb_linmap_type_mod
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
contains
procedure, pass(map) :: sizeof => d_map_sizeof
end type psb_dlinmap_type
type psb_clinmap_type
@ -73,6 +77,8 @@ module psb_linmap_type_mod
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
contains
procedure, pass(map) :: sizeof => c_map_sizeof
end type psb_clinmap_type
type psb_zlinmap_type
@ -80,7 +86,97 @@ module psb_linmap_type_mod
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
contains
procedure, pass(map) :: sizeof => z_map_sizeof
end type psb_zlinmap_type
private :: s_map_sizeof, d_map_sizeof, c_map_sizeof, z_map_sizeof
contains
function s_map_sizeof(map) result(val)
use psb_descriptor_type
use psb_s_mat_mod
implicit none
class(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 + map%desc_X%sizeof()
val = val + map%desc_Y%sizeof()
val = val + map%map_X2Y%sizeof()
val = val + map%map_Y2X%sizeof()
end function s_map_sizeof
function d_map_sizeof(map) result(val)
use psb_descriptor_type
use psb_d_mat_mod
implicit none
class(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 + map%desc_X%sizeof()
val = val + map%desc_Y%sizeof()
val = val + map%map_X2Y%sizeof()
val = val + map%map_Y2X%sizeof()
end function d_map_sizeof
function c_map_sizeof(map) result(val)
use psb_descriptor_type
use psb_c_mat_mod
implicit none
class(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 + map%desc_X%sizeof()
val = val + map%desc_Y%sizeof()
val = val + map%map_X2Y%sizeof()
val = val + map%map_Y2X%sizeof()
end function c_map_sizeof
function z_map_sizeof(map) result(val)
use psb_descriptor_type
use psb_z_mat_mod
implicit none
class(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 + map%desc_X%sizeof()
val = val + map%desc_Y%sizeof()
val = val + map%map_X2Y%sizeof()
val = val + map%map_Y2X%sizeof()
end function z_map_sizeof
end module psb_linmap_type_mod

Loading…
Cancel
Save