Skip to content

Commit 4cd6cf2

Browse files
committed
Exposed to c the psb_is_owned function
1 parent d16b39e commit 4cd6cf2

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

cbind/base/psb_base_tools_cbind_mod.F90

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,5 +390,25 @@ function psb_c_cd_get_global_indices(idx,nidx,owned,cdh) &
390390

391391
end function psb_c_cd_get_global_indices
392392

393+
function psb_c_is_owned(x,cdh) bind(c,name='psb_c_is_owned') result(res)
394+
implicit none
395+
type(psb_c_object_type) :: cdh
396+
integer(psb_c_lpk_), value :: x
397+
logical(c_bool) :: res
398+
! Internal variables
399+
type(psb_desc_type), pointer :: descp
400+
integer(psb_c_ipk_) :: info
401+
logical :: fowned
402+
res = .false.
403+
if (c_associated(cdh%item)) then
404+
call c_f_pointer(cdh%item,descp)
405+
fowned = psb_is_owned(x+(1-psb_c_get_index_base()),descp)
406+
if (fowned) then
407+
res = .true.
408+
end if
409+
end if
410+
411+
end function psb_c_is_owned
412+
393413

394414
end module psb_base_tools_cbind_mod

cbind/base/psb_c_base.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ extern "C" {
8080
psb_i_t psb_c_cdasb(psb_c_descriptor *cd);
8181
psb_i_t psb_c_cdfree(psb_c_descriptor *cd);
8282
psb_i_t psb_c_cdins(psb_i_t nz, const psb_l_t *ia, const psb_l_t *ja, psb_c_descriptor *cd);
83-
83+
bool psb_c_is_owned(psb_l_t gindex, psb_c_descriptor *cd);
8484

8585
psb_i_t psb_c_cd_get_local_rows(psb_c_descriptor *cd);
8686
psb_i_t psb_c_cd_get_local_cols(psb_c_descriptor *cd);

0 commit comments

Comments
 (0)