psblas3-mcbind:
cbind/base/Makefile cbind/base/psb_c_dcomm.c cbind/base/psb_c_dcomm.h cbind/base/psb_d_comm_cbind.f90 Start of comm.psblas3-mcbind
parent
8883291d56
commit
b039a1b109
@ -1,4 +1,35 @@
|
||||
#include <stdlib.h>
|
||||
#include "psb_c_dcomm.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "psb_c_dbase.h"
|
||||
|
||||
|
||||
psb_d_t* psb_c_dvgather(psb_c_dvector *xh, psb_c_descriptor *cdh)
|
||||
{
|
||||
psb_d_t *temp=NULL;
|
||||
psb_i_t vsize=0;
|
||||
|
||||
if ((vsize=psb_c_cd_get_global_rows(cdh))<0)
|
||||
return(temp);
|
||||
|
||||
if (vsize==0)
|
||||
vsize=1;
|
||||
|
||||
if ((temp=(psb_d_t *)malloc(vsize*sizeof(psb_d_t)))!=NULL)
|
||||
psb_c_dvgather_f(temp,xh,cdh);
|
||||
|
||||
return(temp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
psb_c_dspmat* psb_c_dspgather(psb_c_dspmat *ah, psb_c_descriptor *cdh)
|
||||
{
|
||||
psb_c_dspmat* temp=psb_c_new_dspmat();
|
||||
|
||||
psb_c_dspgather_f(temp, ah, cdh);
|
||||
return(temp);
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,74 @@
|
||||
module psb_d_comm_cbind_mod
|
||||
use iso_c_binding
|
||||
use psb_base_mod
|
||||
use psb_objhandle_mod
|
||||
use psb_base_string_cbind_mod
|
||||
use psb_base_tools_cbind_mod
|
||||
|
||||
contains
|
||||
|
||||
|
||||
function psb_c_dvgather_f(v,xh,cdh) bind(c) result(res)
|
||||
implicit none
|
||||
|
||||
integer(psb_c_int) :: res
|
||||
real(c_double) :: v(*)
|
||||
type(psb_c_dvector) :: xh
|
||||
type(psb_c_descriptor) :: cdh
|
||||
|
||||
type(psb_desc_type), pointer :: descp
|
||||
type(psb_d_vect_type), pointer :: vp
|
||||
real(psb_dpk_), allocatable :: fv(:)
|
||||
integer :: info, sz
|
||||
|
||||
res = -1
|
||||
|
||||
if (c_associated(cdh%item)) then
|
||||
call c_f_pointer(cdh%item,descp)
|
||||
else
|
||||
return
|
||||
end if
|
||||
if (c_associated(xh%item)) then
|
||||
call c_f_pointer(xh%item,vp)
|
||||
call psb_gather(fv,vp,descp,info)
|
||||
res = info
|
||||
if (res /=0) return
|
||||
sz = size(fv)
|
||||
v(1:sz) = fv(1:sz)
|
||||
end if
|
||||
end function psb_c_dvgather_f
|
||||
|
||||
function psb_c_dspgather_f(gah,ah,cdh) bind(c) result(res)
|
||||
implicit none
|
||||
|
||||
integer(psb_c_int) :: res
|
||||
type(psb_c_dspmat) :: ah, gah
|
||||
type(psb_c_descriptor) :: cdh
|
||||
|
||||
type(psb_desc_type), pointer :: descp
|
||||
type(psb_dspmat_type), pointer :: ap, gap
|
||||
integer :: info, sz
|
||||
|
||||
res = -1
|
||||
if (c_associated(cdh%item)) then
|
||||
call c_f_pointer(cdh%item,descp)
|
||||
else
|
||||
return
|
||||
end if
|
||||
if (c_associated(ah%item)) then
|
||||
call c_f_pointer(ah%item,ap)
|
||||
else
|
||||
return
|
||||
end if
|
||||
if (c_associated(gah%item)) then
|
||||
call c_f_pointer(gah%item,gap)
|
||||
else
|
||||
return
|
||||
end if
|
||||
call psb_gather(gap,ap,descp,info)
|
||||
res = info
|
||||
end function psb_c_dspgather_f
|
||||
|
||||
|
||||
end module psb_d_comm_cbind_mod
|
||||
|
Loading…
Reference in New Issue