Added routine to get integer context for c-mpi interoperability

newG2L
Cirdans-Home 4 years ago
parent 321814d247
commit e64d52cbc2

@ -316,8 +316,10 @@ module psb_const_mod
integer(psb_ipk_), parameter, public :: psb_err_invalid_preca_=5004
type psb_ctxt_type
type :: psb_ctxt_type
integer(psb_mpk_), allocatable :: ctxt
contains
procedure, pass(ctxt) :: get_i_ctxt => psb_get_i_ctxt
end type psb_ctxt_type
contains
@ -334,4 +336,19 @@ contains
end function psb_cmp_ctxt
subroutine psb_get_i_ctxt(ctxt,ictxt,info)
class(psb_ctxt_type), intent(in) :: ctxt
integer(psb_mpk_), intent(out) :: ictxt
integer(psb_ipk_), intent(out) :: info
if (.not.allocated(ctxt%ctxt)) then
ictxt = -1_psb_ipk_
info = psb_err_mpi_error_
else
ictxt = ctxt%ctxt
info = psb_success_
end if
end subroutine psb_get_i_ctxt
end module psb_const_mod

@ -65,6 +65,7 @@ extern "C" {
void psb_c_abort(psb_c_ctxt cctxt);
void psb_c_barrier(psb_c_ctxt cctxt);
void psb_c_info(psb_c_ctxt cctxt, psb_i_t *iam, psb_i_t *np);
void psb_c_get_i_ctxt(psb_c_ctxt cctxt, psb_i_t *ictxt, psb_i_t *info);
psb_d_t psb_c_wtime();
psb_i_t psb_c_get_errstatus();

@ -63,6 +63,21 @@ contains
if (c_associated(cctxt%item)) call c_f_pointer(cctxt%item,res)
end function psb_c2f_ctxt
subroutine psb_c_get_i_ctxt(cctxt,ictxt,info) bind(c)
implicit none
type(psb_c_object_type), value :: cctxt
integer(psb_c_ipk_) :: ictxt
integer(psb_c_ipk_) :: info
! Local variables
type(psb_ctxt_type), pointer :: ctxt
ctxt => psb_c2f_ctxt(cctxt)
call ctxt%get_i_ctxt(ictxt,info)
end subroutine
subroutine psb_c_exit_ctxt(cctxt) bind(c)
use psb_base_mod, only : psb_exit, psb_ctxt_type
type(psb_c_object_type), value :: cctxt

Loading…
Cancel
Save