Added function psb_c_g2l

remap-coarse
Cirdans-Home 4 years ago
parent f40c69e695
commit c38660c76c

@ -102,6 +102,8 @@ extern "C" {
psb_i_t psb_c_cd_get_local_cols(psb_c_descriptor *cd);
psb_l_t psb_c_cd_get_global_rows(psb_c_descriptor *cd);
psb_i_t psb_c_cd_get_global_indices(psb_l_t idx[], psb_i_t nidx, bool owned, psb_c_descriptor *cd);
psb_i_t psb_c_g2l(psb_c_descriptor *cdh,psb_l_t gindex,bool cowned);
/* legal values for upd argument */
#define psb_upd_srch_ 98764

@ -204,5 +204,38 @@ contains
end function psb_c_cvect_set_vect
function psb_c_g2l(cdh,gindex,cowned) bind(c) result(lindex)
use psb_base_mod
implicit none
integer(psb_c_lpk_), value :: gindex
logical(c_bool), value :: cowned
type(psb_c_descriptor) :: cdh
integer(psb_c_ipk_) :: lindex
type(psb_desc_type), pointer :: descp
integer(psb_ipk_) :: info, localindex, ixb, iam, np
logical :: owned
ixb = psb_c_get_index_base()
owned = cowned
lindex = -1
if (c_associated(cdh%item)) then
call c_f_pointer(cdh%item,descp)
else
return
end if
call psb_info(descp%get_context(),iam,np)
if (ixb == 1) then
call descp%indxmap%g2l(gindex,localindex,info,owned=owned)
lindex = localindex
else
call descp%indxmap%g2l(gindex+(1-ixb),localindex,info,owned=owned)
lindex = localindex-(1-ixb)
endif
end function psb_c_g2l
end module psb_c_serial_cbind_mod

Loading…
Cancel
Save