From 8e450ee69c27246e2d29a6fe7617be874af2b324 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Tue, 22 Nov 2011 13:10:53 +0000 Subject: [PATCH] psblas3: prec/psb_c_base_prec_mod.f90 prec/psb_c_bjacprec.f90 prec/psb_c_diagprec.f90 prec/psb_d_base_prec_mod.f90 prec/psb_d_bjacprec.f90 prec/psb_d_diagprec.f90 prec/psb_s_base_prec_mod.f90 prec/psb_s_bjacprec.f90 prec/psb_s_diagprec.f90 prec/psb_z_base_prec_mod.f90 prec/psb_z_bjacprec.f90 prec/psb_z_diagprec.f90 Merged get_nzeros() method for preconditioners. --- prec/psb_c_base_prec_mod.f90 | 11 ++++++++++- prec/psb_c_bjacprec.f90 | 21 +++++++++++++++++++-- prec/psb_c_diagprec.f90 | 16 ++++++++++++++-- prec/psb_d_base_prec_mod.f90 | 12 +++++++++++- prec/psb_d_bjacprec.f90 | 21 +++++++++++++++++++-- prec/psb_d_diagprec.f90 | 15 +++++++++++++-- prec/psb_s_base_prec_mod.f90 | 11 ++++++++++- prec/psb_s_bjacprec.f90 | 21 +++++++++++++++++++-- prec/psb_s_diagprec.f90 | 15 +++++++++++++-- prec/psb_z_base_prec_mod.f90 | 11 ++++++++++- prec/psb_z_bjacprec.f90 | 21 +++++++++++++++++++-- prec/psb_z_diagprec.f90 | 15 +++++++++++++-- 12 files changed, 170 insertions(+), 20 deletions(-) diff --git a/prec/psb_c_base_prec_mod.f90 b/prec/psb_c_base_prec_mod.f90 index 24f33274..cd98e220 100644 --- a/prec/psb_c_base_prec_mod.f90 +++ b/prec/psb_c_base_prec_mod.f90 @@ -61,13 +61,14 @@ module psb_c_base_prec_mod procedure, pass(prec) :: precfree => psb_c_base_precfree procedure, pass(prec) :: precdescr => psb_c_base_precdescr procedure, pass(prec) :: dump => psb_c_base_precdump + procedure, pass(prec) :: get_nzeros => psb_c_base_get_nzeros end type psb_c_base_prec_type private :: psb_c_base_apply, psb_c_base_precbld, psb_c_base_precseti,& & psb_c_base_precsetr, psb_c_base_precsetc, psb_c_base_sizeof,& & psb_c_base_precinit, psb_c_base_precfree, psb_c_base_precdescr,& & psb_c_base_precdump, psb_c_base_set_ctxt, psb_c_base_get_ctxt, & - & psb_c_base_apply_vect + & psb_c_base_apply_vect, psb_c_base_get_nzeros contains @@ -444,4 +445,12 @@ contains return end function psb_c_base_get_ctxt + function psb_c_base_get_nzeros(prec) result(res) + class(psb_c_base_prec_type), intent(in) :: prec + integer(psb_long_int_k_) :: res + + res = 0 + + end function psb_c_base_get_nzeros + end module psb_c_base_prec_mod diff --git a/prec/psb_c_bjacprec.f90 b/prec/psb_c_bjacprec.f90 index 77634e91..2f525142 100644 --- a/prec/psb_c_bjacprec.f90 +++ b/prec/psb_c_bjacprec.f90 @@ -19,12 +19,13 @@ module psb_c_bjacprec procedure, pass(prec) :: precdescr => psb_c_bjac_precdescr procedure, pass(prec) :: dump => psb_c_bjac_dump procedure, pass(prec) :: sizeof => psb_c_bjac_sizeof + procedure, pass(prec) :: get_nzeros => psb_c_bjac_get_nzeros end type psb_c_bjac_prec_type private :: psb_c_bjac_apply, psb_c_bjac_precbld, psb_c_bjac_precseti,& & psb_c_bjac_precsetr, psb_c_bjac_precsetc, psb_c_bjac_sizeof,& & psb_c_bjac_precinit, psb_c_bjac_precfree, psb_c_bjac_precdescr,& - & psb_c_bjac_dump, psb_c_bjac_apply_vect + & psb_c_bjac_dump, psb_c_bjac_apply_vect, psb_c_bjac_get_nzeros character(len=15), parameter, private :: & @@ -773,7 +774,7 @@ contains end subroutine psb_c_bjac_dump function psb_c_bjac_sizeof(prec) result(val) - use psb_base_mod + use psb_base_mod, only : psb_long_int_k_ class(psb_c_bjac_prec_type), intent(in) :: prec integer(psb_long_int_k_) :: val @@ -788,4 +789,20 @@ contains return end function psb_c_bjac_sizeof + function psb_c_bjac_get_nzeros(prec) result(val) + use psb_base_mod, only : psb_long_int_k_ + class(psb_c_bjac_prec_type), intent(in) :: prec + integer(psb_long_int_k_) :: val + + val = 0 + if (allocated(prec%dv)) then + val = val + prec%dv%get_nrows() + endif + if (allocated(prec%av)) then + val = val + prec%av(psb_l_pr_)%get_nzeros() + val = val + prec%av(psb_u_pr_)%get_nzeros() + endif + return + end function psb_c_bjac_get_nzeros + end module psb_c_bjacprec diff --git a/prec/psb_c_diagprec.f90 b/prec/psb_c_diagprec.f90 index af8e27e1..7c2979c2 100644 --- a/prec/psb_c_diagprec.f90 +++ b/prec/psb_c_diagprec.f90 @@ -16,12 +16,13 @@ module psb_c_diagprec procedure, pass(prec) :: precfree => psb_c_diag_precfree procedure, pass(prec) :: precdescr => psb_c_diag_precdescr procedure, pass(prec) :: sizeof => psb_c_diag_sizeof + procedure, pass(prec) :: get_nzeros => psb_c_diag_get_nzeros end type psb_c_diag_prec_type private :: psb_c_diag_apply, psb_c_diag_precbld, psb_c_diag_precseti,& & psb_c_diag_precsetr, psb_c_diag_precsetc, psb_c_diag_sizeof,& & psb_c_diag_precinit, psb_c_diag_precfree, psb_c_diag_precdescr,& - & psb_c_diag_apply_vect + & psb_c_diag_apply_vect, psb_c_diag_get_nzeros contains @@ -464,7 +465,7 @@ contains end subroutine psb_c_diag_precdescr function psb_c_diag_sizeof(prec) result(val) - use psb_base_mod + use psb_base_mod, only : psb_long_int_k_ class(psb_c_diag_prec_type), intent(in) :: prec integer(psb_long_int_k_) :: val @@ -473,4 +474,15 @@ contains return end function psb_c_diag_sizeof + function psb_c_diag_get_nzeros(prec) result(val) + use psb_base_mod, only: psb_long_int_k_ + class(psb_c_diag_prec_type), intent(in) :: prec + integer(psb_long_int_k_) :: val + + val = 0 + if (allocated(prec%dv)) val = val + prec%dv%get_nrows() + return + end function psb_c_diag_get_nzeros + + end module psb_c_diagprec diff --git a/prec/psb_d_base_prec_mod.f90 b/prec/psb_d_base_prec_mod.f90 index 20e62a22..d046d501 100644 --- a/prec/psb_d_base_prec_mod.f90 +++ b/prec/psb_d_base_prec_mod.f90 @@ -62,13 +62,14 @@ module psb_d_base_prec_mod procedure, pass(prec) :: precfree => psb_d_base_precfree procedure, pass(prec) :: precdescr => psb_d_base_precdescr procedure, pass(prec) :: dump => psb_d_base_precdump + procedure, pass(prec) :: get_nzeros => psb_d_base_get_nzeros end type psb_d_base_prec_type private :: psb_d_base_apply, psb_d_base_precbld, psb_d_base_precseti,& & psb_d_base_precsetr, psb_d_base_precsetc, psb_d_base_sizeof,& & psb_d_base_precinit, psb_d_base_precfree, psb_d_base_precdescr,& & psb_d_base_precdump, psb_d_base_set_ctxt, psb_d_base_get_ctxt, & - & psb_d_base_apply_vect + & psb_d_base_apply_vect, psb_d_base_get_nzeros contains @@ -445,4 +446,13 @@ contains return end function psb_d_base_get_ctxt + function psb_d_base_get_nzeros(prec) result(res) + class(psb_d_base_prec_type), intent(in) :: prec + integer(psb_long_int_k_) :: res + + res = 0 + + end function psb_d_base_get_nzeros + + end module psb_d_base_prec_mod diff --git a/prec/psb_d_bjacprec.f90 b/prec/psb_d_bjacprec.f90 index bbfa673b..1a14c8f6 100644 --- a/prec/psb_d_bjacprec.f90 +++ b/prec/psb_d_bjacprec.f90 @@ -18,12 +18,13 @@ module psb_d_bjacprec procedure, pass(prec) :: precdescr => psb_d_bjac_precdescr procedure, pass(prec) :: dump => psb_d_bjac_dump procedure, pass(prec) :: sizeof => psb_d_bjac_sizeof + procedure, pass(prec) :: get_nzeros => psb_d_bjac_get_nzeros end type psb_d_bjac_prec_type private :: psb_d_bjac_apply, psb_d_bjac_precbld, psb_d_bjac_precseti,& & psb_d_bjac_precsetr, psb_d_bjac_precsetc, psb_d_bjac_sizeof,& & psb_d_bjac_precinit, psb_d_bjac_precfree, psb_d_bjac_precdescr,& - & psb_d_bjac_dump, psb_d_bjac_apply_vect + & psb_d_bjac_dump, psb_d_bjac_apply_vect, psb_d_bjac_get_nzeros character(len=15), parameter, private :: & @@ -762,7 +763,7 @@ contains end subroutine psb_d_bjac_dump function psb_d_bjac_sizeof(prec) result(val) - use psb_base_mod + use psb_base_mod, only : psb_long_int_k_ class(psb_d_bjac_prec_type), intent(in) :: prec integer(psb_long_int_k_) :: val @@ -777,4 +778,20 @@ contains return end function psb_d_bjac_sizeof + function psb_d_bjac_get_nzeros(prec) result(val) + use psb_base_mod, only : psb_long_int_k_ + class(psb_d_bjac_prec_type), intent(in) :: prec + integer(psb_long_int_k_) :: val + + val = 0 + if (allocated(prec%dv)) then + val = val + prec%dv%get_nrows() + endif + if (allocated(prec%av)) then + val = val + prec%av(psb_l_pr_)%get_nzeros() + val = val + prec%av(psb_u_pr_)%get_nzeros() + endif + return + end function psb_d_bjac_get_nzeros + end module psb_d_bjacprec diff --git a/prec/psb_d_diagprec.f90 b/prec/psb_d_diagprec.f90 index 9985089b..30158ce1 100644 --- a/prec/psb_d_diagprec.f90 +++ b/prec/psb_d_diagprec.f90 @@ -17,12 +17,13 @@ module psb_d_diagprec procedure, pass(prec) :: precfree => psb_d_diag_precfree procedure, pass(prec) :: precdescr => psb_d_diag_precdescr procedure, pass(prec) :: sizeof => psb_d_diag_sizeof + procedure, pass(prec) :: get_nzeros => psb_d_diag_get_nzeros end type psb_d_diag_prec_type private :: psb_d_diag_apply, psb_d_diag_precbld, psb_d_diag_precseti,& & psb_d_diag_precsetr, psb_d_diag_precsetc, psb_d_diag_sizeof,& & psb_d_diag_precinit, psb_d_diag_precfree, psb_d_diag_precdescr,& - & psb_d_diag_apply_vect + & psb_d_diag_apply_vect, psb_d_diag_get_nzeros contains @@ -464,7 +465,7 @@ contains end subroutine psb_d_diag_precdescr function psb_d_diag_sizeof(prec) result(val) - use psb_base_mod + use psb_base_mod, only: psb_long_int_k_ class(psb_d_diag_prec_type), intent(in) :: prec integer(psb_long_int_k_) :: val @@ -473,4 +474,14 @@ contains return end function psb_d_diag_sizeof + function psb_d_diag_get_nzeros(prec) result(val) + use psb_base_mod, only: psb_long_int_k_ + class(psb_d_diag_prec_type), intent(in) :: prec + integer(psb_long_int_k_) :: val + + val = 0 + if (allocated(prec%dv)) val = val + prec%dv%get_nrows() + return + end function psb_d_diag_get_nzeros + end module psb_d_diagprec diff --git a/prec/psb_s_base_prec_mod.f90 b/prec/psb_s_base_prec_mod.f90 index d37f0439..339d9aa8 100644 --- a/prec/psb_s_base_prec_mod.f90 +++ b/prec/psb_s_base_prec_mod.f90 @@ -62,13 +62,14 @@ module psb_s_base_prec_mod procedure, pass(prec) :: precfree => psb_s_base_precfree procedure, pass(prec) :: precdescr => psb_s_base_precdescr procedure, pass(prec) :: dump => psb_s_base_precdump + procedure, pass(prec) :: get_nzeros => psb_s_base_get_nzeros end type psb_s_base_prec_type private :: psb_s_base_apply, psb_s_base_precbld, psb_s_base_precseti,& & psb_s_base_precsetr, psb_s_base_precsetc, psb_s_base_sizeof,& & psb_s_base_precinit, psb_s_base_precfree, psb_s_base_precdescr,& & psb_s_base_precdump, psb_s_base_set_ctxt, psb_s_base_get_ctxt, & - & psb_s_base_apply_vect + & psb_s_base_apply_vect, psb_s_base_get_nzeros contains @@ -445,4 +446,12 @@ contains return end function psb_s_base_get_ctxt + function psb_s_base_get_nzeros(prec) result(res) + class(psb_s_base_prec_type), intent(in) :: prec + integer(psb_long_int_k_) :: res + + res = 0 + + end function psb_s_base_get_nzeros + end module psb_s_base_prec_mod diff --git a/prec/psb_s_bjacprec.f90 b/prec/psb_s_bjacprec.f90 index d5cdd557..aee62bd5 100644 --- a/prec/psb_s_bjacprec.f90 +++ b/prec/psb_s_bjacprec.f90 @@ -19,12 +19,13 @@ module psb_s_bjacprec procedure, pass(prec) :: precdescr => psb_s_bjac_precdescr procedure, pass(prec) :: dump => psb_s_bjac_dump procedure, pass(prec) :: sizeof => psb_s_bjac_sizeof + procedure, pass(prec) :: get_nzeros => psb_s_bjac_get_nzeros end type psb_s_bjac_prec_type private :: psb_s_bjac_apply, psb_s_bjac_precbld, psb_s_bjac_precseti,& & psb_s_bjac_precsetr, psb_s_bjac_precsetc, psb_s_bjac_sizeof,& & psb_s_bjac_precinit, psb_s_bjac_precfree, psb_s_bjac_precdescr,& - & psb_s_bjac_dump, psb_s_bjac_apply_vect + & psb_s_bjac_dump, psb_s_bjac_apply_vect, psb_s_bjac_get_nzeros character(len=15), parameter, private :: & @@ -771,7 +772,7 @@ contains end subroutine psb_s_bjac_dump function psb_s_bjac_sizeof(prec) result(val) - use psb_base_mod + use psb_base_mod, only : psb_long_int_k_ class(psb_s_bjac_prec_type), intent(in) :: prec integer(psb_long_int_k_) :: val @@ -786,4 +787,20 @@ contains return end function psb_s_bjac_sizeof + function psb_s_bjac_get_nzeros(prec) result(val) + use psb_base_mod, only : psb_long_int_k_ + class(psb_s_bjac_prec_type), intent(in) :: prec + integer(psb_long_int_k_) :: val + + val = 0 + if (allocated(prec%dv)) then + val = val + prec%dv%get_nrows() + endif + if (allocated(prec%av)) then + val = val + prec%av(psb_l_pr_)%get_nzeros() + val = val + prec%av(psb_u_pr_)%get_nzeros() + endif + return + end function psb_s_bjac_get_nzeros + end module psb_s_bjacprec diff --git a/prec/psb_s_diagprec.f90 b/prec/psb_s_diagprec.f90 index ba498fb0..2fb89dcd 100644 --- a/prec/psb_s_diagprec.f90 +++ b/prec/psb_s_diagprec.f90 @@ -16,12 +16,13 @@ module psb_s_diagprec procedure, pass(prec) :: precfree => psb_s_diag_precfree procedure, pass(prec) :: precdescr => psb_s_diag_precdescr procedure, pass(prec) :: sizeof => psb_s_diag_sizeof + procedure, pass(prec) :: get_nzeros => psb_s_diag_get_nzeros end type psb_s_diag_prec_type private :: psb_s_diag_apply, psb_s_diag_precbld, psb_s_diag_precseti,& & psb_s_diag_precsetr, psb_s_diag_precsetc, psb_s_diag_sizeof,& & psb_s_diag_precinit, psb_s_diag_precfree, psb_s_diag_precdescr,& - & psb_s_diag_apply_vect + & psb_s_diag_apply_vect, psb_s_diag_get_nzeros contains @@ -481,7 +482,7 @@ contains end subroutine psb_s_diag_precdescr function psb_s_diag_sizeof(prec) result(val) - use psb_base_mod + use psb_base_mod, only : psb_long_int_k_ class(psb_s_diag_prec_type), intent(in) :: prec integer(psb_long_int_k_) :: val @@ -490,4 +491,14 @@ contains return end function psb_s_diag_sizeof + function psb_s_diag_get_nzeros(prec) result(val) + use psb_base_mod, only: psb_long_int_k_ + class(psb_s_diag_prec_type), intent(in) :: prec + integer(psb_long_int_k_) :: val + + val = 0 + if (allocated(prec%dv)) val = val + prec%dv%get_nrows() + return + end function psb_s_diag_get_nzeros + end module psb_s_diagprec diff --git a/prec/psb_z_base_prec_mod.f90 b/prec/psb_z_base_prec_mod.f90 index 2a7866d0..39193e27 100644 --- a/prec/psb_z_base_prec_mod.f90 +++ b/prec/psb_z_base_prec_mod.f90 @@ -61,13 +61,14 @@ module psb_z_base_prec_mod procedure, pass(prec) :: precfree => psb_z_base_precfree procedure, pass(prec) :: precdescr => psb_z_base_precdescr procedure, pass(prec) :: dump => psb_z_base_precdump + procedure, pass(prec) :: get_nzeros => psb_z_base_get_nzeros end type psb_z_base_prec_type private :: psb_z_base_apply, psb_z_base_precbld, psb_z_base_precseti,& & psb_z_base_precsetr, psb_z_base_precsetc, psb_z_base_sizeof,& & psb_z_base_precinit, psb_z_base_precfree, psb_z_base_precdescr,& & psb_z_base_precdump, psb_z_base_set_ctxt, psb_z_base_get_ctxt, & - & psb_z_base_apply_vect + & psb_z_base_apply_vect, psb_z_base_get_nzeros contains @@ -444,4 +445,12 @@ contains return end function psb_z_base_get_ctxt + function psb_z_base_get_nzeros(prec) result(res) + class(psb_z_base_prec_type), intent(in) :: prec + integer(psb_long_int_k_) :: res + + res = 0 + + end function psb_z_base_get_nzeros + end module psb_z_base_prec_mod diff --git a/prec/psb_z_bjacprec.f90 b/prec/psb_z_bjacprec.f90 index bf2cc19a..d4885f20 100644 --- a/prec/psb_z_bjacprec.f90 +++ b/prec/psb_z_bjacprec.f90 @@ -19,12 +19,13 @@ module psb_z_bjacprec procedure, pass(prec) :: precdescr => psb_z_bjac_precdescr procedure, pass(prec) :: dump => psb_z_bjac_dump procedure, pass(prec) :: sizeof => psb_z_bjac_sizeof + procedure, pass(prec) :: get_nzeros => psb_z_bjac_get_nzeros end type psb_z_bjac_prec_type private :: psb_z_bjac_apply, psb_z_bjac_precbld, psb_z_bjac_precseti,& & psb_z_bjac_precsetr, psb_z_bjac_precsetc, psb_z_bjac_sizeof,& & psb_z_bjac_precinit, psb_z_bjac_precfree, psb_z_bjac_precdescr,& - & psb_z_bjac_dump, psb_z_bjac_apply_vect + & psb_z_bjac_dump, psb_z_bjac_apply_vect, psb_z_bjac_get_nzeros character(len=15), parameter, private :: & @@ -763,7 +764,7 @@ contains end subroutine psb_z_bjac_dump function psb_z_bjac_sizeof(prec) result(val) - use psb_base_mod + use psb_base_mod, only : psb_long_int_k_ class(psb_z_bjac_prec_type), intent(in) :: prec integer(psb_long_int_k_) :: val @@ -778,4 +779,20 @@ contains return end function psb_z_bjac_sizeof + function psb_z_bjac_get_nzeros(prec) result(val) + use psb_base_mod, only : psb_long_int_k_ + class(psb_z_bjac_prec_type), intent(in) :: prec + integer(psb_long_int_k_) :: val + + val = 0 + if (allocated(prec%dv)) then + val = val + prec%dv%get_nrows() + endif + if (allocated(prec%av)) then + val = val + prec%av(psb_l_pr_)%get_nzeros() + val = val + prec%av(psb_u_pr_)%get_nzeros() + endif + return + end function psb_z_bjac_get_nzeros + end module psb_z_bjacprec diff --git a/prec/psb_z_diagprec.f90 b/prec/psb_z_diagprec.f90 index c254aee0..c892994b 100644 --- a/prec/psb_z_diagprec.f90 +++ b/prec/psb_z_diagprec.f90 @@ -16,12 +16,13 @@ module psb_z_diagprec procedure, pass(prec) :: precfree => psb_z_diag_precfree procedure, pass(prec) :: precdescr => psb_z_diag_precdescr procedure, pass(prec) :: sizeof => psb_z_diag_sizeof + procedure, pass(prec) :: get_nzeros => psb_z_diag_get_nzeros end type psb_z_diag_prec_type private :: psb_z_diag_apply, psb_z_diag_precbld, psb_z_diag_precseti,& & psb_z_diag_precsetr, psb_z_diag_precsetc, psb_z_diag_sizeof,& & psb_z_diag_precinit, psb_z_diag_precfree, psb_z_diag_precdescr,& - & psb_z_diag_apply_vect + & psb_z_diag_apply_vect, psb_z_diag_get_nzeros contains @@ -464,7 +465,7 @@ contains end subroutine psb_z_diag_precdescr function psb_z_diag_sizeof(prec) result(val) - use psb_base_mod + use psb_base_mod, only : psb_long_int_k_ class(psb_z_diag_prec_type), intent(in) :: prec integer(psb_long_int_k_) :: val @@ -473,4 +474,14 @@ contains return end function psb_z_diag_sizeof + function psb_z_diag_get_nzeros(prec) result(val) + use psb_base_mod, only: psb_long_int_k_ + class(psb_z_diag_prec_type), intent(in) :: prec + integer(psb_long_int_k_) :: val + + val = 0 + if (allocated(prec%dv)) val = val + prec%dv%get_nrows() + return + end function psb_z_diag_get_nzeros + end module psb_z_diagprec