From 4cd6cf21d02f86ee9ae7ca1cdc2589fd8fd12eaa Mon Sep 17 00:00:00 2001 From: Fabio Durastante Date: Wed, 1 Oct 2025 14:34:00 +0200 Subject: [PATCH] Exposed to c the psb_is_owned function --- cbind/base/psb_base_tools_cbind_mod.F90 | 20 ++++++++++++++++++++ cbind/base/psb_c_base.h | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/cbind/base/psb_base_tools_cbind_mod.F90 b/cbind/base/psb_base_tools_cbind_mod.F90 index 7126ced8..d8aa0769 100644 --- a/cbind/base/psb_base_tools_cbind_mod.F90 +++ b/cbind/base/psb_base_tools_cbind_mod.F90 @@ -390,5 +390,25 @@ contains end function psb_c_cd_get_global_indices + function psb_c_is_owned(x,cdh) bind(c,name='psb_c_is_owned') result(res) + implicit none + type(psb_c_object_type) :: cdh + integer(psb_c_lpk_), value :: x + logical(c_bool) :: res + ! Internal variables + type(psb_desc_type), pointer :: descp + integer(psb_c_ipk_) :: info + logical :: fowned + res = .false. + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + fowned = psb_is_owned(x+(1-psb_c_get_index_base()),descp) + if (fowned) then + res = .true. + end if + end if + + end function psb_c_is_owned + end module psb_base_tools_cbind_mod diff --git a/cbind/base/psb_c_base.h b/cbind/base/psb_c_base.h index f28f7bbb..6dacb3de 100644 --- a/cbind/base/psb_c_base.h +++ b/cbind/base/psb_c_base.h @@ -80,7 +80,7 @@ extern "C" { psb_i_t psb_c_cdasb(psb_c_descriptor *cd); psb_i_t psb_c_cdfree(psb_c_descriptor *cd); psb_i_t psb_c_cdins(psb_i_t nz, const psb_l_t *ia, const psb_l_t *ja, psb_c_descriptor *cd); - + bool psb_c_is_owned(psb_l_t gindex, psb_c_descriptor *cd); psb_i_t psb_c_cd_get_local_rows(psb_c_descriptor *cd); psb_i_t psb_c_cd_get_local_cols(psb_c_descriptor *cd);