Added C interface psb_c_cd_get_global_indices for descriptor objects

pizdaint-runs
Cirdans-Home 5 years ago
parent 3c3470b50e
commit ac3afe962d

@ -301,5 +301,34 @@ contains
end function psb_c_cd_get_global_cols
function psb_c_cd_get_global_indices(idx,nidx,owned,cdh) bind(c,name='psb_c_cd_get_global_indices') result(res)
implicit none
integer(psb_c_ipk_) :: res
type(psb_c_object_type) :: cdh
integer(psb_c_lpk_) :: idx(nidx)
integer(psb_c_ipk_), value :: nidx
logical(c_bool), value :: owned
type(psb_desc_type), pointer :: descp
integer(psb_lpk_), allocatable :: myidx(:)
logical :: fowned
res = -1
if (c_associated(cdh%item)) then
call c_f_pointer(cdh%item,descp)
fowned = owned
myidx = descp%get_global_indices(owned=fowned)
idx(1:nidx) = myidx(1:nidx)
res = 0
end if
end function psb_c_cd_get_global_indices
end module psb_base_tools_cbind_mod

@ -13,7 +13,7 @@ extern "C" {
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
typedef int32_t psb_m_t;
@ -29,20 +29,20 @@ extern "C" {
#else
#endif
typedef int64_t psb_e_t;
typedef float psb_s_t;
typedef double psb_d_t;
typedef float complex psb_c_t;
typedef double complex psb_z_t;
#define PSB_ERR_ERROR -1
#define PSB_ERR_SUCCESS 0
typedef struct PSB_C_DESCRIPTOR {
void *descriptor;
} psb_c_descriptor;
} psb_c_descriptor;
psb_i_t psb_c_error();
psb_i_t psb_c_clean_errstack();
@ -53,7 +53,7 @@ extern "C" {
void psb_c_seterraction_print();
void psb_c_seterraction_abort();
/* Environment routines */
/* Environment routines */
psb_i_t psb_c_init();
void psb_c_exit_ctxt(psb_i_t ictxt);
void psb_c_exit(psb_i_t ictxt);
@ -65,7 +65,7 @@ extern "C" {
psb_i_t psb_c_get_index_base();
void psb_c_set_index_base(psb_i_t base);
void psb_c_mbcast(psb_i_t ictxt, psb_i_t n, psb_m_t *v, psb_i_t root);
void psb_c_ibcast(psb_i_t ictxt, psb_i_t n, psb_i_t *v, psb_i_t root);
void psb_c_lbcast(psb_i_t ictxt, psb_i_t n, psb_l_t *v, psb_i_t root);
@ -75,8 +75,8 @@ extern "C" {
void psb_c_cbcast(psb_i_t ictxt, psb_i_t n, psb_c_t *v, psb_i_t root);
void psb_c_zbcast(psb_i_t ictxt, psb_i_t n, psb_z_t *v, psb_i_t root);
void psb_c_hbcast(psb_i_t ictxt, const char *v, psb_i_t root);
/* Descriptor/integer routines */
/* Descriptor/integer routines */
psb_c_descriptor* psb_c_new_descriptor();
psb_i_t psb_c_cdall_vg(psb_l_t ng, psb_i_t *vg, psb_i_t ictxt, psb_c_descriptor *cd);
psb_i_t psb_c_cdall_vl(psb_i_t nl, psb_l_t *vl, psb_i_t ictxt, psb_c_descriptor *cd);
@ -85,25 +85,25 @@ 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);
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);
psb_l_t psb_c_cd_get_global_rows(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);
/* legal values for upd argument */
/* legal values for upd argument */
#define psb_upd_srch_ 98764
#define psb_upd_perm_ 98765
#define psb_upd_def_ psb_upd_srch_
/* legal values for dupl argument */
/* legal values for dupl argument */
#define psb_dupl_ovwrt_ 0
#define psb_dupl_add_ 1
#define psb_dupl_err_ 2
#define psb_dupl_def_ psb_dupl_ovwrt_
/* legal values for afmt */
/* legal values for afmt */
#define PSB_AFMT_CSR "CSR"
#define PSB_AFMT_CSC "CSC"
#define PSB_AFMT_COO "COO"
@ -113,21 +113,21 @@ extern "C" {
#define psb_NoTrans_ "N"
#define psb_Trans_ "T"
#define psb_ConjTrans_ "C"
/* legal values for halo swap modes argument */
/* legal values for halo swap modes argument */
#define psb_swap_send_ 1
#define psb_swap_recv_ 2
#define psb_swap_sync_ 4
#define psb_swap_mpi_ 8
/* legal values for ovrl update argument */
/* legal values for ovrl update argument */
#define psb_none_ 0
#define psb_sum_ 1
#define psb_avg_ 2
#define psb_square_root_ 3
#define psb_setzero_ 4
#ifdef __cplusplus
}
#endif /* __cplusplus */

Loading…
Cancel
Save