From dc7af8b82e874c0b61366c02ee713ab1a0ddde9d Mon Sep 17 00:00:00 2001 From: sfilippone Date: Fri, 12 Jun 2026 15:10:14 +0200 Subject: [PATCH] Define is_asb & friends in C interface --- cbind/base/psb_c_serial_cbind_mod.F90 | 228 ++++++++++++++++++++++++++ cbind/base/psb_d_psblas_cbind_mod.f90 | 227 ------------------------- cbind/base/psb_d_serial_cbind_mod.F90 | 228 ++++++++++++++++++++++++++ cbind/base/psb_s_serial_cbind_mod.F90 | 228 ++++++++++++++++++++++++++ cbind/base/psb_z_serial_cbind_mod.F90 | 228 ++++++++++++++++++++++++++ 5 files changed, 912 insertions(+), 227 deletions(-) diff --git a/cbind/base/psb_c_serial_cbind_mod.F90 b/cbind/base/psb_c_serial_cbind_mod.F90 index ab8ad7e1f..d5e59c3b9 100644 --- a/cbind/base/psb_c_serial_cbind_mod.F90 +++ b/cbind/base/psb_c_serial_cbind_mod.F90 @@ -273,4 +273,232 @@ contains res = xp%get_entry((index+(1-ixb))) end function psb_c_cvect_get_entry + function psb_c_cnnz(ah,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_cspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_cspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info + + res = 0 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + res = psb_nnz(ap,descp,info) + + end function psb_c_cnnz + + function psb_c_cis_matupd(ah,cdh) bind(c) result(res) + implicit none + logical(c_bool) :: res + + type(psb_c_cspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_cspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info + + res = .false. + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + res = ap%is_upd() + end function + + function psb_c_cis_matasb(ah,cdh) bind(c) result(res) + implicit none + logical(c_bool) :: res + + type(psb_c_cspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_cspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info + + res = .false. + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + res = ap%is_asb() + end function + + function psb_c_cis_matbld(ah,cdh) bind(c) result(res) + implicit none + logical(c_bool) :: res + + type(psb_c_cspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_cspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info + + res = .false. + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + res = ap%is_bld() + end function + + function psb_c_cset_matupd(ah,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_cspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_cspmat_type), pointer :: ap + + res = -1 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + call ap%set_upd() + + res = psb_success_ + end function + + function psb_c_cset_matasb(ah,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_cspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_cspmat_type), pointer :: ap + + res = -1; + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + call ap%set_asb() + + res = psb_success_ + + end function + + function psb_c_cset_matbld(ah,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_cspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_cspmat_type), pointer :: ap + + res = -1 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + call ap%set_bld() + + res = psb_success_ + end function + + function psb_c_ccopy_mat(ah,bh,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_cspmat) :: ah,bh + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_cspmat_type), pointer :: ap,bp + integer(psb_c_ipk_) :: info + + res = -1 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + if (c_associated(bh%item)) then + call c_f_pointer(bh%item,bp) + else + return + end if + + call ap%clone(bp,info) + + res = info + end function + end module psb_c_serial_cbind_mod diff --git a/cbind/base/psb_d_psblas_cbind_mod.f90 b/cbind/base/psb_d_psblas_cbind_mod.f90 index da5aa2e21..45a80ebd5 100644 --- a/cbind/base/psb_d_psblas_cbind_mod.f90 +++ b/cbind/base/psb_d_psblas_cbind_mod.f90 @@ -1042,233 +1042,6 @@ contains end function psb_c_dspsm - function psb_c_dnnz(ah,cdh) bind(c) result(res) - implicit none - integer(psb_c_ipk_) :: res - - type(psb_c_dspmat) :: ah - type(psb_c_descriptor) :: cdh - - type(psb_desc_type), pointer :: descp - type(psb_dspmat_type), pointer :: ap - integer(psb_c_ipk_) :: info - - res = 0 - - if (c_associated(cdh%item)) then - call c_f_pointer(cdh%item,descp) - else - return - end if - if (c_associated(ah%item)) then - call c_f_pointer(ah%item,ap) - else - return - end if - - res = psb_nnz(ap,descp,info) - - end function psb_c_dnnz - - function psb_c_dis_matupd(ah,cdh) bind(c) result(res) - implicit none - logical(c_bool) :: res - - type(psb_c_dspmat) :: ah - type(psb_c_descriptor) :: cdh - - type(psb_desc_type), pointer :: descp - type(psb_dspmat_type), pointer :: ap - integer(psb_c_ipk_) :: info - - res = .false. - - if (c_associated(cdh%item)) then - call c_f_pointer(cdh%item,descp) - else - return - end if - if (c_associated(ah%item)) then - call c_f_pointer(ah%item,ap) - else - return - end if - - res = ap%is_upd() - end function - - function psb_c_dis_matasb(ah,cdh) bind(c) result(res) - implicit none - logical(c_bool) :: res - - type(psb_c_dspmat) :: ah - type(psb_c_descriptor) :: cdh - - type(psb_desc_type), pointer :: descp - type(psb_dspmat_type), pointer :: ap - integer(psb_c_ipk_) :: info - - res = .false. - - if (c_associated(cdh%item)) then - call c_f_pointer(cdh%item,descp) - else - return - end if - if (c_associated(ah%item)) then - call c_f_pointer(ah%item,ap) - else - return - end if - - res = ap%is_asb() - end function - - function psb_c_dis_matbld(ah,cdh) bind(c) result(res) - implicit none - logical(c_bool) :: res - - type(psb_c_dspmat) :: ah - type(psb_c_descriptor) :: cdh - - type(psb_desc_type), pointer :: descp - type(psb_dspmat_type), pointer :: ap - integer(psb_c_ipk_) :: info - - res = .false. - - if (c_associated(cdh%item)) then - call c_f_pointer(cdh%item,descp) - else - return - end if - if (c_associated(ah%item)) then - call c_f_pointer(ah%item,ap) - else - return - end if - - res = ap%is_bld() - end function - - function psb_c_dset_matupd(ah,cdh) bind(c) result(res) - implicit none - integer(psb_c_ipk_) :: res - - type(psb_c_dspmat) :: ah - type(psb_c_descriptor) :: cdh - - type(psb_desc_type), pointer :: descp - type(psb_dspmat_type), pointer :: ap - - res = -1 - - if (c_associated(cdh%item)) then - call c_f_pointer(cdh%item,descp) - else - return - end if - if (c_associated(ah%item)) then - call c_f_pointer(ah%item,ap) - else - return - end if - - call ap%set_upd() - - res = psb_success_ - end function - - function psb_c_dset_matasb(ah,cdh) bind(c) result(res) - implicit none - integer(psb_c_ipk_) :: res - - type(psb_c_dspmat) :: ah - type(psb_c_descriptor) :: cdh - - type(psb_desc_type), pointer :: descp - type(psb_dspmat_type), pointer :: ap - - res = -1; - - if (c_associated(cdh%item)) then - call c_f_pointer(cdh%item,descp) - else - return - end if - if (c_associated(ah%item)) then - call c_f_pointer(ah%item,ap) - else - return - end if - - call ap%set_asb() - - res = psb_success_ - - end function - - function psb_c_dset_matbld(ah,cdh) bind(c) result(res) - implicit none - integer(psb_c_ipk_) :: res - - type(psb_c_dspmat) :: ah - type(psb_c_descriptor) :: cdh - - type(psb_desc_type), pointer :: descp - type(psb_dspmat_type), pointer :: ap - - res = -1 - - if (c_associated(cdh%item)) then - call c_f_pointer(cdh%item,descp) - else - return - end if - if (c_associated(ah%item)) then - call c_f_pointer(ah%item,ap) - else - return - end if - - call ap%set_bld() - - res = psb_success_ - end function - - function psb_c_dcopy_mat(ah,bh,cdh) bind(c) result(res) - implicit none - integer(psb_c_ipk_) :: res - - type(psb_c_dspmat) :: ah,bh - type(psb_c_descriptor) :: cdh - - type(psb_desc_type), pointer :: descp - type(psb_dspmat_type), pointer :: ap,bp - integer(psb_c_ipk_) :: info - - res = -1 - - if (c_associated(cdh%item)) then - call c_f_pointer(cdh%item,descp) - else - return - end if - if (c_associated(ah%item)) then - call c_f_pointer(ah%item,ap) - else - return - end if - if (c_associated(bh%item)) then - call c_f_pointer(bh%item,bp) - else - return - end if - - call ap%clone(bp,info) - - res = info - end function function psb_c_dspscal(alpha,ah,cdh) bind(c) result(res) implicit none diff --git a/cbind/base/psb_d_serial_cbind_mod.F90 b/cbind/base/psb_d_serial_cbind_mod.F90 index dc559c647..a85607921 100644 --- a/cbind/base/psb_d_serial_cbind_mod.F90 +++ b/cbind/base/psb_d_serial_cbind_mod.F90 @@ -273,4 +273,232 @@ contains res = xp%get_entry((index+(1-ixb))) end function psb_c_dvect_get_entry + function psb_c_dnnz(ah,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_dspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_dspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info + + res = 0 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + res = psb_nnz(ap,descp,info) + + end function psb_c_dnnz + + function psb_c_dis_matupd(ah,cdh) bind(c) result(res) + implicit none + logical(c_bool) :: res + + type(psb_c_dspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_dspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info + + res = .false. + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + res = ap%is_upd() + end function + + function psb_c_dis_matasb(ah,cdh) bind(c) result(res) + implicit none + logical(c_bool) :: res + + type(psb_c_dspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_dspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info + + res = .false. + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + res = ap%is_asb() + end function + + function psb_c_dis_matbld(ah,cdh) bind(c) result(res) + implicit none + logical(c_bool) :: res + + type(psb_c_dspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_dspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info + + res = .false. + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + res = ap%is_bld() + end function + + function psb_c_dset_matupd(ah,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_dspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_dspmat_type), pointer :: ap + + res = -1 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + call ap%set_upd() + + res = psb_success_ + end function + + function psb_c_dset_matasb(ah,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_dspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_dspmat_type), pointer :: ap + + res = -1; + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + call ap%set_asb() + + res = psb_success_ + + end function + + function psb_c_dset_matbld(ah,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_dspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_dspmat_type), pointer :: ap + + res = -1 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + call ap%set_bld() + + res = psb_success_ + end function + + function psb_c_dcopy_mat(ah,bh,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_dspmat) :: ah,bh + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_dspmat_type), pointer :: ap,bp + integer(psb_c_ipk_) :: info + + res = -1 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + if (c_associated(bh%item)) then + call c_f_pointer(bh%item,bp) + else + return + end if + + call ap%clone(bp,info) + + res = info + end function + end module psb_d_serial_cbind_mod diff --git a/cbind/base/psb_s_serial_cbind_mod.F90 b/cbind/base/psb_s_serial_cbind_mod.F90 index 93fc7f8d3..a2f222d92 100644 --- a/cbind/base/psb_s_serial_cbind_mod.F90 +++ b/cbind/base/psb_s_serial_cbind_mod.F90 @@ -273,4 +273,232 @@ contains res = xp%get_entry((index+(1-ixb))) end function psb_c_svect_get_entry + function psb_c_snnz(ah,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_sspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_sspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info + + res = 0 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + res = psb_nnz(ap,descp,info) + + end function psb_c_snnz + + function psb_c_sis_matupd(ah,cdh) bind(c) result(res) + implicit none + logical(c_bool) :: res + + type(psb_c_sspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_sspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info + + res = .false. + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + res = ap%is_upd() + end function + + function psb_c_sis_matasb(ah,cdh) bind(c) result(res) + implicit none + logical(c_bool) :: res + + type(psb_c_sspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_sspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info + + res = .false. + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + res = ap%is_asb() + end function + + function psb_c_sis_matbld(ah,cdh) bind(c) result(res) + implicit none + logical(c_bool) :: res + + type(psb_c_sspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_sspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info + + res = .false. + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + res = ap%is_bld() + end function + + function psb_c_sset_matupd(ah,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_sspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_sspmat_type), pointer :: ap + + res = -1 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + call ap%set_upd() + + res = psb_success_ + end function + + function psb_c_sset_matasb(ah,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_sspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_sspmat_type), pointer :: ap + + res = -1; + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + call ap%set_asb() + + res = psb_success_ + + end function + + function psb_c_sset_matbld(ah,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_sspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_sspmat_type), pointer :: ap + + res = -1 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + call ap%set_bld() + + res = psb_success_ + end function + + function psb_c_scopy_mat(ah,bh,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_sspmat) :: ah,bh + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_sspmat_type), pointer :: ap,bp + integer(psb_c_ipk_) :: info + + res = -1 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + if (c_associated(bh%item)) then + call c_f_pointer(bh%item,bp) + else + return + end if + + call ap%clone(bp,info) + + res = info + end function + end module psb_s_serial_cbind_mod diff --git a/cbind/base/psb_z_serial_cbind_mod.F90 b/cbind/base/psb_z_serial_cbind_mod.F90 index 15a46bb53..c379a0b8d 100644 --- a/cbind/base/psb_z_serial_cbind_mod.F90 +++ b/cbind/base/psb_z_serial_cbind_mod.F90 @@ -273,4 +273,232 @@ contains res = xp%get_entry((index+(1-ixb))) end function psb_c_zvect_get_entry + function psb_c_znnz(ah,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_zspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_zspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info + + res = 0 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + res = psb_nnz(ap,descp,info) + + end function psb_c_znnz + + function psb_c_zis_matupd(ah,cdh) bind(c) result(res) + implicit none + logical(c_bool) :: res + + type(psb_c_zspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_zspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info + + res = .false. + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + res = ap%is_upd() + end function + + function psb_c_zis_matasb(ah,cdh) bind(c) result(res) + implicit none + logical(c_bool) :: res + + type(psb_c_zspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_zspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info + + res = .false. + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + res = ap%is_asb() + end function + + function psb_c_zis_matbld(ah,cdh) bind(c) result(res) + implicit none + logical(c_bool) :: res + + type(psb_c_zspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_zspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info + + res = .false. + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + res = ap%is_bld() + end function + + function psb_c_zset_matupd(ah,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_zspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_zspmat_type), pointer :: ap + + res = -1 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + call ap%set_upd() + + res = psb_success_ + end function + + function psb_c_zset_matasb(ah,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_zspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_zspmat_type), pointer :: ap + + res = -1; + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + call ap%set_asb() + + res = psb_success_ + + end function + + function psb_c_zset_matbld(ah,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_zspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_zspmat_type), pointer :: ap + + res = -1 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + call ap%set_bld() + + res = psb_success_ + end function + + function psb_c_zcopy_mat(ah,bh,cdh) bind(c) result(res) + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_zspmat) :: ah,bh + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_zspmat_type), pointer :: ap,bp + integer(psb_c_ipk_) :: info + + res = -1 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + if (c_associated(bh%item)) then + call c_f_pointer(bh%item,bp) + else + return + end if + + call ap%clone(bp,info) + + res = info + end function + end module psb_z_serial_cbind_mod