Merge branch 'precinit' of https://github.com/sfilippone/psblas3 into precinit

MixedI8
Salvatore Filippone 6 years ago
commit 814ddce711

@ -1,3 +1,4 @@
#ifndef PSB_C_BASE__ #ifndef PSB_C_BASE__
#define PSB_C_BASE__ #define PSB_C_BASE__
#ifdef __cplusplus #ifdef __cplusplus

@ -13,7 +13,7 @@ contains
use psb_prec_cbind_mod use psb_prec_cbind_mod
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int) :: res
type(psb_c_cspmat) :: ah type(psb_c_cspmat) :: ah
type(psb_c_descriptor) :: cdh type(psb_c_descriptor) :: cdh
type(psb_c_cprec) :: ph type(psb_c_cprec) :: ph
@ -38,14 +38,14 @@ contains
use psb_prec_cbind_mod use psb_prec_cbind_mod
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int) :: res
type(psb_c_cspmat) :: ah type(psb_c_cspmat) :: ah
type(psb_c_descriptor) :: cdh type(psb_c_descriptor) :: cdh
type(psb_c_cprec) :: ph type(psb_c_cprec) :: ph
type(psb_c_cvector) :: bh,xh type(psb_c_cvector) :: bh,xh
integer(c_int), value :: itmax,itrace,irst,istop integer(psb_c_int), value :: itmax,itrace,irst,istop
real(c_double), value :: eps real(c_double), value :: eps
integer(c_int) :: iter integer(psb_c_int) :: iter
real(c_double) :: err real(c_double) :: err
character(c_char) :: methd(*) character(c_char) :: methd(*)
type(solveroptions) :: options type(solveroptions) :: options

@ -13,7 +13,7 @@ contains
use psb_prec_cbind_mod use psb_prec_cbind_mod
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int) :: res
type(psb_c_dspmat) :: ah type(psb_c_dspmat) :: ah
type(psb_c_descriptor) :: cdh type(psb_c_descriptor) :: cdh
type(psb_c_dprec) :: ph type(psb_c_dprec) :: ph
@ -21,7 +21,6 @@ contains
character(c_char) :: methd(*) character(c_char) :: methd(*)
type(solveroptions) :: options type(solveroptions) :: options
write(0,*) 'psb_c_dkrylov options ', options%eps
res= psb_c_dkrylov_opt(methd, ah, ph, bh, xh, options%eps,cdh, & res= psb_c_dkrylov_opt(methd, ah, ph, bh, xh, options%eps,cdh, &
& itmax=options%itmax, iter=options%iter,& & itmax=options%itmax, iter=options%iter,&
& itrace=options%itrace, istop=options%istop,& & itrace=options%itrace, istop=options%istop,&
@ -39,14 +38,14 @@ contains
use psb_prec_cbind_mod use psb_prec_cbind_mod
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int) :: res
type(psb_c_dspmat) :: ah type(psb_c_dspmat) :: ah
type(psb_c_descriptor) :: cdh type(psb_c_descriptor) :: cdh
type(psb_c_dprec) :: ph type(psb_c_dprec) :: ph
type(psb_c_dvector) :: bh,xh type(psb_c_dvector) :: bh,xh
integer(c_int), value :: itmax,itrace,irst,istop integer(psb_c_int), value :: itmax,itrace,irst,istop
real(c_double), value :: eps real(c_double), value :: eps
integer(c_int) :: iter integer(psb_c_int) :: iter
real(c_double) :: err real(c_double) :: err
character(c_char) :: methd(*) character(c_char) :: methd(*)
type(solveroptions) :: options type(solveroptions) :: options
@ -59,7 +58,6 @@ contains
character(len=20) :: fmethd character(len=20) :: fmethd
real(psb_dpk_) :: feps,ferr real(psb_dpk_) :: feps,ferr
write(0,*) 'psb_c_dkrylov_opt options ', eps
res = -1 res = -1
if (c_associated(cdh%item)) then if (c_associated(cdh%item)) then
call c_f_pointer(cdh%item,descp) call c_f_pointer(cdh%item,descp)

@ -13,7 +13,7 @@ contains
use psb_prec_cbind_mod use psb_prec_cbind_mod
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int) :: res
type(psb_c_sspmat) :: ah type(psb_c_sspmat) :: ah
type(psb_c_descriptor) :: cdh type(psb_c_descriptor) :: cdh
type(psb_c_sprec) :: ph type(psb_c_sprec) :: ph
@ -38,14 +38,14 @@ contains
use psb_prec_cbind_mod use psb_prec_cbind_mod
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int) :: res
type(psb_c_sspmat) :: ah type(psb_c_sspmat) :: ah
type(psb_c_descriptor) :: cdh type(psb_c_descriptor) :: cdh
type(psb_c_sprec) :: ph type(psb_c_sprec) :: ph
type(psb_c_svector) :: bh,xh type(psb_c_svector) :: bh,xh
integer(c_int), value :: itmax,itrace,irst,istop integer(psb_c_int), value :: itmax,itrace,irst,istop
real(c_double), value :: eps real(c_double), value :: eps
integer(c_int) :: iter integer(psb_c_int) :: iter
real(c_double) :: err real(c_double) :: err
character(c_char) :: methd(*) character(c_char) :: methd(*)
type(solveroptions) :: options type(solveroptions) :: options

@ -13,7 +13,7 @@ contains
use psb_prec_cbind_mod use psb_prec_cbind_mod
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int) :: res
type(psb_c_zspmat) :: ah type(psb_c_zspmat) :: ah
type(psb_c_descriptor) :: cdh type(psb_c_descriptor) :: cdh
type(psb_c_zprec) :: ph type(psb_c_zprec) :: ph
@ -38,14 +38,14 @@ contains
use psb_prec_cbind_mod use psb_prec_cbind_mod
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int) :: res
type(psb_c_zspmat) :: ah type(psb_c_zspmat) :: ah
type(psb_c_descriptor) :: cdh type(psb_c_descriptor) :: cdh
type(psb_c_zprec) :: ph type(psb_c_zprec) :: ph
type(psb_c_zvector) :: bh,xh type(psb_c_zvector) :: bh,xh
integer(c_int), value :: itmax,itrace,irst,istop integer(psb_c_int), value :: itmax,itrace,irst,istop
real(c_double), value :: eps real(c_double), value :: eps
integer(c_int) :: iter integer(psb_c_int) :: iter
real(c_double) :: err real(c_double) :: err
character(c_char) :: methd(*) character(c_char) :: methd(*)
type(solveroptions) :: options type(solveroptions) :: options

@ -8,15 +8,15 @@
extern "C" { extern "C" {
#endif #endif
typedef struct PSB_C_CPREC { typedef struct PSB_C_CPREC {
void *cprec; void *cprec;
} psb_c_cprec; } psb_c_cprec;
psb_c_cprec* psb_c_new_cprec(); psb_c_cprec* psb_c_new_cprec();
psb_i_t psb_c_cprecinit(psb_c_cprec *ph, const char *ptype); psb_i_t psb_c_cprecinit(psb_i_t ictxt,psb_c_cprec *ph, const char *ptype);
psb_i_t psb_c_cprecbld(psb_c_cspmat *ah, psb_c_descriptor *cdh, psb_c_cprec *ph); psb_i_t psb_c_cprecbld(psb_c_cspmat *ah, psb_c_descriptor *cdh, psb_c_cprec *ph);
psb_i_t psb_c_cprecfree(psb_c_cprec *ph); psb_i_t psb_c_cprecfree(psb_c_cprec *ph);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

@ -8,15 +8,15 @@
extern "C" { extern "C" {
#endif #endif
typedef struct PSB_C_DPREC { typedef struct PSB_C_DPREC {
void *dprec; void *dprec;
} psb_c_dprec; } psb_c_dprec;
psb_c_dprec* psb_c_new_dprec(); psb_c_dprec* psb_c_new_dprec();
psb_i_t psb_c_dprecinit(psb_c_dprec *ph, const char *ptype); psb_i_t psb_c_dprecinit(psb_i_t ictxt, psb_c_dprec *ph, const char *ptype);
psb_i_t psb_c_dprecbld(psb_c_dspmat *ah, psb_c_descriptor *cdh, psb_c_dprec *ph); psb_i_t psb_c_dprecbld(psb_c_dspmat *ah, psb_c_descriptor *cdh, psb_c_dprec *ph);
psb_i_t psb_c_dprecfree(psb_c_dprec *ph); psb_i_t psb_c_dprecfree(psb_c_dprec *ph);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

@ -8,15 +8,15 @@
extern "C" { extern "C" {
#endif #endif
typedef struct PSB_C_SPREC { typedef struct PSB_C_SPREC {
void *sprec; void *sprec;
} psb_c_sprec; } psb_c_sprec;
psb_c_sprec* psb_c_new_sprec(); psb_c_sprec* psb_c_new_sprec();
psb_i_t psb_c_sprecinit(psb_c_sprec *ph, const char *ptype); psb_i_t psb_c_sprecinit(psb_i_t ictxt, psb_c_sprec *ph, const char *ptype);
psb_i_t psb_c_sprecbld(psb_c_sspmat *ah, psb_c_descriptor *cdh, psb_c_sprec *ph); psb_i_t psb_c_sprecbld(psb_c_sspmat *ah, psb_c_descriptor *cdh, psb_c_sprec *ph);
psb_i_t psb_c_sprecfree(psb_c_sprec *ph); psb_i_t psb_c_sprecfree(psb_c_sprec *ph);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

@ -8,15 +8,15 @@
extern "C" { extern "C" {
#endif #endif
typedef struct PSB_C_ZPREC { typedef struct PSB_C_ZPREC {
void *zprec; void *zprec;
} psb_c_zprec; } psb_c_zprec;
psb_c_zprec* psb_c_new_zprec(); psb_c_zprec* psb_c_new_zprec();
psb_i_t psb_c_zprecinit(psb_c_zprec *ph, const char *ptype); psb_i_t psb_c_zprecinit(psb_i_t ictxt, psb_c_zprec *ph, const char *ptype);
psb_i_t psb_c_zprecbld(psb_c_zspmat *ah, psb_c_descriptor *cdh, psb_c_zprec *ph); psb_i_t psb_c_zprecbld(psb_c_zspmat *ah, psb_c_descriptor *cdh, psb_c_zprec *ph);
psb_i_t psb_c_zprecfree(psb_c_zprec *ph); psb_i_t psb_c_zprecfree(psb_c_zprec *ph);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

@ -13,12 +13,13 @@ module psb_cprec_cbind_mod
contains contains
function psb_c_cprecinit(ph,ptype) bind(c) result(res) function psb_c_cprecinit(ictxt,ph,ptype) bind(c) result(res)
use psb_base_mod use psb_base_mod
use psb_prec_mod use psb_prec_mod
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int), value :: ictxt
integer(psb_c_int) :: res
type(psb_c_cprec) :: ph type(psb_c_cprec) :: ph
character(c_char) :: ptype(*) character(c_char) :: ptype(*)
type(psb_cprec_type), pointer :: precp type(psb_cprec_type), pointer :: precp
@ -36,7 +37,7 @@ contains
call stringc2f(ptype,fptype) call stringc2f(ptype,fptype)
call psb_precinit(precp,fptype,info) call psb_precinit(ictxt,precp,fptype,info)
res = min(0,info) res = min(0,info)
return return
@ -51,7 +52,7 @@ contains
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int) :: res
type(psb_c_cspmat) :: ah type(psb_c_cspmat) :: ah
type(psb_c_cprec) :: ph type(psb_c_cprec) :: ph
type(psb_c_descriptor) :: cdh type(psb_c_descriptor) :: cdh
@ -94,7 +95,7 @@ contains
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int) :: res
type(psb_c_cprec) :: ph type(psb_c_cprec) :: ph
type(psb_cprec_type), pointer :: precp type(psb_cprec_type), pointer :: precp

@ -13,12 +13,13 @@ module psb_dprec_cbind_mod
contains contains
function psb_c_dprecinit(ph,ptype) bind(c) result(res) function psb_c_dprecinit(ictxt,ph,ptype) bind(c) result(res)
use psb_base_mod use psb_base_mod
use psb_prec_mod use psb_prec_mod
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int), value :: ictxt
integer(psb_c_int) :: res
type(psb_c_dprec) :: ph type(psb_c_dprec) :: ph
character(c_char) :: ptype(*) character(c_char) :: ptype(*)
type(psb_dprec_type), pointer :: precp type(psb_dprec_type), pointer :: precp
@ -36,7 +37,7 @@ contains
call stringc2f(ptype,fptype) call stringc2f(ptype,fptype)
call psb_precinit(precp,fptype,info) call psb_precinit(ictxt,precp,fptype,info)
res = min(0,info) res = min(0,info)
return return
@ -51,7 +52,7 @@ contains
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int) :: res
type(psb_c_dspmat) :: ah type(psb_c_dspmat) :: ah
type(psb_c_dprec) :: ph type(psb_c_dprec) :: ph
type(psb_c_descriptor) :: cdh type(psb_c_descriptor) :: cdh
@ -94,7 +95,7 @@ contains
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int) :: res
type(psb_c_dprec) :: ph type(psb_c_dprec) :: ph
type(psb_dprec_type), pointer :: precp type(psb_dprec_type), pointer :: precp

@ -13,12 +13,13 @@ module psb_sprec_cbind_mod
contains contains
function psb_c_sprecinit(ph,ptype) bind(c) result(res) function psb_c_sprecinit(ictxt,ph,ptype) bind(c) result(res)
use psb_base_mod use psb_base_mod
use psb_prec_mod use psb_prec_mod
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int), value :: ictxt
integer(psb_c_int) :: res
type(psb_c_sprec) :: ph type(psb_c_sprec) :: ph
character(c_char) :: ptype(*) character(c_char) :: ptype(*)
type(psb_sprec_type), pointer :: precp type(psb_sprec_type), pointer :: precp
@ -36,7 +37,7 @@ contains
call stringc2f(ptype,fptype) call stringc2f(ptype,fptype)
call psb_precinit(precp,fptype,info) call psb_precinit(ictxt,precp,fptype,info)
res = min(0,info) res = min(0,info)
return return
@ -51,7 +52,7 @@ contains
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int) :: res
type(psb_c_sspmat) :: ah type(psb_c_sspmat) :: ah
type(psb_c_sprec) :: ph type(psb_c_sprec) :: ph
type(psb_c_descriptor) :: cdh type(psb_c_descriptor) :: cdh
@ -94,7 +95,7 @@ contains
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int) :: res
type(psb_c_sprec) :: ph type(psb_c_sprec) :: ph
type(psb_sprec_type), pointer :: precp type(psb_sprec_type), pointer :: precp

@ -13,12 +13,13 @@ module psb_zprec_cbind_mod
contains contains
function psb_c_zprecinit(ph,ptype) bind(c) result(res) function psb_c_zprecinit(ictxt,ph,ptype) bind(c) result(res)
use psb_base_mod use psb_base_mod
use psb_prec_mod use psb_prec_mod
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int), value :: ictxt
integer(psb_c_int) :: res
type(psb_c_zprec) :: ph type(psb_c_zprec) :: ph
character(c_char) :: ptype(*) character(c_char) :: ptype(*)
type(psb_zprec_type), pointer :: precp type(psb_zprec_type), pointer :: precp
@ -36,7 +37,7 @@ contains
call stringc2f(ptype,fptype) call stringc2f(ptype,fptype)
call psb_precinit(precp,fptype,info) call psb_precinit(ictxt,precp,fptype,info)
res = min(0,info) res = min(0,info)
return return
@ -51,7 +52,7 @@ contains
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int) :: res
type(psb_c_zspmat) :: ah type(psb_c_zspmat) :: ah
type(psb_c_zprec) :: ph type(psb_c_zprec) :: ph
type(psb_c_descriptor) :: cdh type(psb_c_descriptor) :: cdh
@ -94,7 +95,7 @@ contains
use psb_base_string_cbind_mod use psb_base_string_cbind_mod
implicit none implicit none
integer(c_int) :: res integer(psb_c_int) :: res
type(psb_c_zprec) :: ph type(psb_c_zprec) :: ph
type(psb_zprec_type), pointer :: precp type(psb_zprec_type), pointer :: precp

@ -320,7 +320,7 @@ int main(int argc, char *argv[])
psb_c_barrier(ictxt); psb_c_barrier(ictxt);
/* Set up the preconditioner */ /* Set up the preconditioner */
ph = psb_c_new_dprec(); ph = psb_c_new_dprec();
psb_c_dprecinit(ph,ptype); psb_c_dprecinit(ictxt,ph,ptype);
ret=psb_c_dprecbld(ah,cdh,ph); ret=psb_c_dprecbld(ah,cdh,ph);
fprintf(stderr,"From psb_c_dprecbld: %d\n",ret); fprintf(stderr,"From psb_c_dprecbld: %d\n",ret);

Loading…
Cancel
Save