Change CONTEXT and use of AMG prefix instead of MLD

merge-amgext
Salvatore Filippone 4 years ago
parent b751d726a1
commit 661ff4e042

@ -1,20 +1,20 @@
#include <stdlib.h> #include <stdlib.h>
#include "mld_c_dprec.h" #include "amg_c_dprec.h"
mld_c_dprec* mld_c_dprec_new() amg_c_dprec* amg_c_dprec_new()
{ {
mld_c_dprec* temp; amg_c_dprec* temp;
temp=(mld_c_dprec *) malloc(sizeof(mld_c_dprec)); temp=(amg_c_dprec *) malloc(sizeof(amg_c_dprec));
temp->dprec=NULL; temp->dprec=NULL;
return(temp); return(temp);
} }
int mld_c_dprec_delete(mld_c_dprec* p) int amg_c_dprec_delete(amg_c_dprec* p)
{ {
int iret; int iret;
iret=mld_c_dprecfree(p); iret=amg_c_dprecfree(p);
if (iret ==0) free(p); if (iret ==0) free(p);
return(iret); return(iret);
} }

@ -1,37 +1,37 @@
#ifndef MLD_C_DPREC_ #ifndef AMG_C_DPREC_
#define MLD_C_DPREC_ #define AMG_C_DPREC_
#include "mld_const.h" #include "amg_const.h"
#include "psb_base_cbind.h" #include "psb_base_cbind.h"
#include "psb_prec_cbind.h" #include "psb_prec_cbind.h"
#include "psb_krylov_cbind.h" #include "psb_krylov_cbind.h"
/* Object handle related routines */ /* Object handle related routines */
/* Note: mld_get_XXX_handle returns: <= 0 unsuccessful */ /* Note: amg_get_XXX_handle returns: <= 0 unsuccessful */
/* >0 valid handle */ /* >0 valid handle */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
typedef struct MLD_C_DPREC { typedef struct AMG_C_DPREC {
void *dprec; void *dprec;
} mld_c_dprec; } amg_c_dprec;
mld_c_dprec* mld_c_dprec_new(); amg_c_dprec* amg_c_dprec_new();
psb_i_t mld_c_dprec_delete(mld_c_dprec* p); psb_i_t amg_c_dprec_delete(amg_c_dprec* p);
psb_i_t mld_c_dprecinit(psb_i_t ictxt, mld_c_dprec *ph, const char *ptype); psb_i_t amg_c_dprecinit(psb_i_t ictxt, amg_c_dprec *ph, const char *ptype);
psb_i_t mld_c_dprecseti(mld_c_dprec *ph, const char *what, psb_i_t val); psb_i_t amg_c_dprecseti(amg_c_dprec *ph, const char *what, psb_i_t val);
psb_i_t mld_c_dprecsetc(mld_c_dprec *ph, const char *what, const char *val); psb_i_t amg_c_dprecsetc(amg_c_dprec *ph, const char *what, const char *val);
psb_i_t mld_c_dprecsetr(mld_c_dprec *ph, const char *what, double val); psb_i_t amg_c_dprecsetr(amg_c_dprec *ph, const char *what, double val);
psb_i_t mld_c_dprecbld(psb_c_dspmat *ah, psb_c_descriptor *cdh, mld_c_dprec *ph); psb_i_t amg_c_dprecbld(psb_c_dspmat *ah, psb_c_descriptor *cdh, amg_c_dprec *ph);
psb_i_t mld_c_dhierarchy_build(psb_c_dspmat *ah, psb_c_descriptor *cdh, mld_c_dprec *ph); psb_i_t amg_c_dhierarchy_build(psb_c_dspmat *ah, psb_c_descriptor *cdh, amg_c_dprec *ph);
psb_i_t mld_c_dsmoothers_build(psb_c_dspmat *ah, psb_c_descriptor *cdh, mld_c_dprec *ph); psb_i_t amg_c_dsmoothers_build(psb_c_dspmat *ah, psb_c_descriptor *cdh, amg_c_dprec *ph);
psb_i_t mld_c_dprecfree(mld_c_dprec *ph); psb_i_t amg_c_dprecfree(amg_c_dprec *ph);
psb_i_t mld_c_dprecbld_opt(psb_c_dspmat *ah, psb_c_descriptor *cdh, psb_i_t amg_c_dprecbld_opt(psb_c_dspmat *ah, psb_c_descriptor *cdh,
mld_c_dprec *ph, const char *afmt); amg_c_dprec *ph, const char *afmt);
psb_i_t mld_c_ddescr(mld_c_dprec *ph); psb_i_t amg_c_ddescr(amg_c_dprec *ph);
psb_i_t mld_c_dkrylov(const char *method, psb_c_dspmat *ah, mld_c_dprec *ph, psb_i_t amg_c_dkrylov(const char *method, psb_c_dspmat *ah, amg_c_dprec *ph,
psb_c_dvector *bh, psb_c_dvector *xh, psb_c_dvector *bh, psb_c_dvector *xh,
psb_c_descriptor *cdh, psb_c_SolverOptions *opt); psb_c_descriptor *cdh, psb_c_SolverOptions *opt);

@ -1,20 +1,20 @@
#include <stdlib.h> #include <stdlib.h>
#include "mld_c_dprec.h" #include "amg_c_dprec.h"
mld_c_dprec* mld_c_new_dprec() amg_c_dprec* amg_c_new_dprec()
{ {
mld_c_dprec* temp; amg_c_dprec* temp;
temp=(mld_c_dprec *) malloc(sizeof(mld_c_dprec)); temp=(amg_c_dprec *) malloc(sizeof(amg_c_dprec));
temp->dprec=NULL; temp->dprec=NULL;
return(temp); return(temp);
} }
int mld_c_delete_dprec(mld_c_dprec* p) int amg_c_delete_dprec(amg_c_dprec* p)
{ {
int iret; int iret;
iret=mld_c_dprecfree(p); iret=amg_c_dprecfree(p);
if (iret ==0) free(p); if (iret ==0) free(p);
return(iret); return(iret);
} }

@ -1,38 +1,38 @@
#ifndef MLD_C_ZPREC_ #ifndef AMG_C_ZPREC_
#define MLD_C_ZPREC_ #define AMG_C_ZPREC_
#include "mld_const.h" #include "amg_const.h"
#include "psb_base_cbind.h" #include "psb_base_cbind.h"
#include "psb_prec_cbind.h" #include "psb_prec_cbind.h"
#include "psb_krylov_cbind.h" #include "psb_krylov_cbind.h"
/* Object handle related routines */ /* Object handle related routines */
/* Note: mld_get_XXX_handle returns: <= 0 unsuccessful */ /* Note: amg_get_XXX_handle returns: <= 0 unsuccessful */
/* >0 valid handle */ /* >0 valid handle */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
typedef struct MLD_C_ZPREC { typedef struct AMG_C_ZPREC {
void *dprec; void *dprec;
} mld_c_zprec; } amg_c_zprec;
mld_c_zprec* mld_c_zprec_new(); amg_c_zprec* amg_c_zprec_new();
psb_i_t mld_c_zprec_delete(mld_c_zprec* p); psb_i_t amg_c_zprec_delete(amg_c_zprec* p);
psb_i_t mld_c_zprecinit(psb_i_t ictxt, mld_c_zprec *ph, const char *ptype); psb_i_t amg_c_zprecinit(psb_i_t ictxt, amg_c_zprec *ph, const char *ptype);
psb_i_t mld_c_zprecseti(mld_c_zprec *ph, const char *what, psb_i_t val); psb_i_t amg_c_zprecseti(amg_c_zprec *ph, const char *what, psb_i_t val);
psb_i_t mld_c_zprecsetc(mld_c_zprec *ph, const char *what, const char *val); psb_i_t amg_c_zprecsetc(amg_c_zprec *ph, const char *what, const char *val);
psb_i_t mld_c_zprecsetr(mld_c_zprec *ph, const char *what, double val); psb_i_t amg_c_zprecsetr(amg_c_zprec *ph, const char *what, double val);
psb_i_t mld_c_zprecbld(psb_c_dspmat *ah, psb_c_descriptor *cdh, mld_c_zprec *ph); psb_i_t amg_c_zprecbld(psb_c_dspmat *ah, psb_c_descriptor *cdh, amg_c_zprec *ph);
psb_i_t mld_c_zhierarchy_build(psb_c_dspmat *ah, psb_c_descriptor *cdh, mld_c_zprec *ph); psb_i_t amg_c_zhierarchy_build(psb_c_dspmat *ah, psb_c_descriptor *cdh, amg_c_zprec *ph);
psb_i_t mld_c_zsmoothers_build(psb_c_dspmat *ah, psb_c_descriptor *cdh, mld_c_zprec *ph); psb_i_t amg_c_zsmoothers_build(psb_c_dspmat *ah, psb_c_descriptor *cdh, amg_c_zprec *ph);
psb_i_t mld_c_zprecfree(mld_c_zprec *ph); psb_i_t amg_c_zprecfree(amg_c_zprec *ph);
psb_i_t mld_c_zprecbld_opt(psb_c_zspmat *ah, psb_c_descriptor *cdh, psb_i_t amg_c_zprecbld_opt(psb_c_zspmat *ah, psb_c_descriptor *cdh,
mld_c_zprec *ph, const char *afmt); amg_c_zprec *ph, const char *afmt);
psb_i_t mld_c_zdescr(mld_c_zprec *ph); psb_i_t amg_c_zdescr(amg_c_zprec *ph);
psb_i_t mld_c_zkrylov(const char *method, psb_c_zspmat *ah, mld_c_zprec *ph, psb_i_t amg_c_zkrylov(const char *method, psb_c_zspmat *ah, amg_c_zprec *ph,
psb_c_zvector *bh, psb_c_zvector *xh, psb_c_zvector *bh, psb_c_zvector *xh,
psb_c_descriptor *cdh, psb_c_SolverOptions *opt); psb_c_descriptor *cdh, psb_c_SolverOptions *opt);

@ -1,10 +1,10 @@
#ifndef MLD_CBIND_ #ifndef AMG_CBIND_
#define MLD_CBIND_ #define AMG_CBIND_
#define MLD_VALID_PRECONDITIONER_STRINGS "NONE","DIAG","BJAC","ML","AS" #define AMG_VALID_PRECONDITIONER_STRINGS "NONE","DIAG","BJAC","ML","AS"
#define MLD_VALID_PRECONDITIONER_STRING "NONE DIAG BJAC ML AS" #define AMG_VALID_PRECONDITIONER_STRING "NONE DIAG BJAC ML AS"
#include "mld_const.h" #include "amg_const.h"
#include "mld_c_dprec.h" #include "amg_c_dprec.h"
#endif #endif

@ -1,13 +1,13 @@
/* This file was generated by a script using the mld_base_prec_type.F90 file as a basis. */ /* This file was generated by a script using the amg_base_prec_type.F90 file as a basis. */
#ifndef MLD_CONST_H_ #ifndef AMG_CONST_H_
#define MLD_CONST_H_ #define AMG_CONST_H_
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#define MLD_VERSION_STRING_ ( "2.3.0" ) #define AMG_VERSION_STRING_ ( "1.0.0" )
#define MLD_VERSION_MAJOR_ ( 2 ) #define AMG_VERSION_MAJOR_ ( 1 )
#define MLD_VERSION_MINOR_ ( 3 ) #define AMG_VERSION_MINOR_ ( 0 )
#define MLD_PATCHLEVEL_ ( 0 ) #define AMG_PATCHLEVEL_ ( 0 )
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

@ -1,12 +1,12 @@
module mld_dprec_cbind_mod module amg_dprec_cbind_mod
use iso_c_binding use iso_c_binding
use mld_prec_mod use amg_prec_mod
use psb_base_cbind_mod use psb_base_cbind_mod
type, bind(c) :: mld_c_dprec type, bind(c) :: amg_c_dprec
type(c_ptr) :: item = c_null_ptr type(c_ptr) :: item = c_null_ptr
end type mld_c_dprec end type amg_c_dprec
contains contains
@ -17,22 +17,22 @@ contains
#define MLDC_DEBUG(MSG) #define MLDC_DEBUG(MSG)
#define MLDC_ERROR(MSG) #define MLDC_ERROR(MSG)
#endif #endif
#define mld_success_ 0 #define amg_success_ 0
!#define MLDC_ERR_FILTER(INFO) min(0,INFO) !#define MLDC_ERR_FILTER(INFO) min(0,INFO)
#define MLDC_ERR_FILTER(INFO) (INFO) #define MLDC_ERR_FILTER(INFO) (INFO)
#define MLDC_ERR_HANDLE(INFO) if(INFO/=mld_success_)MLDC_ERROR("ERROR!") #define MLDC_ERR_HANDLE(INFO) if(INFO/=amg_success_)MLDC_ERROR("ERROR!")
function mld_c_dprecinit(cctxt,ph,ptype) bind(c) result(res) function amg_c_dprecinit(cctxt,ph,ptype) bind(c) result(res)
use psb_base_mod use psb_base_mod
use mld_prec_mod use amg_prec_mod
implicit none implicit none
integer(psb_c_ipk_) :: res integer(psb_c_ipk_) :: res
type(mld_c_dprec) :: ph type(amg_c_dprec) :: ph
integer(psb_c_ipk_), value :: cctxt integer(psb_c_ipk_), value :: cctxt
character(c_char) :: ptype(*) character(c_char) :: ptype(*)
integer :: info integer :: info
type(mld_dprec_type), pointer :: precp type(amg_dprec_type), pointer :: precp
character(len=80) :: fptype character(len=80) :: fptype
res = -1 res = -1
@ -48,16 +48,16 @@ contains
call stringc2f(ptype,fptype) call stringc2f(ptype,fptype)
call precp%init(cctxt,fptype,info) call precp%init(psb_c2f_ctxt(cctxt),fptype,info)
res = MLDC_ERR_FILTER(info) res = MLDC_ERR_FILTER(info)
MLDC_ERR_HANDLE(res) MLDC_ERR_HANDLE(res)
return return
end function mld_c_dprecinit end function amg_c_dprecinit
function mld_c_dprecseti(ph,what,val) bind(c) result(res) function amg_c_dprecseti(ph,what,val) bind(c) result(res)
use psb_base_mod use psb_base_mod
use mld_prec_mod use amg_prec_mod
implicit none implicit none
integer(psb_c_ipk_) :: res integer(psb_c_ipk_) :: res
@ -66,7 +66,7 @@ contains
integer(psb_c_ipk_), value :: val integer(psb_c_ipk_), value :: val
integer :: info integer :: info
character(len=80) :: fwhat character(len=80) :: fwhat
type(mld_dprec_type), pointer :: precp type(amg_dprec_type), pointer :: precp
res = -1 res = -1
if (c_associated(ph%item)) then if (c_associated(ph%item)) then
@ -77,17 +77,17 @@ contains
call stringc2f(what,fwhat) call stringc2f(what,fwhat)
call mld_precset(precp,fwhat,val,info) call amg_precset(precp,fwhat,val,info)
res = MLDC_ERR_FILTER(info) res = MLDC_ERR_FILTER(info)
MLDC_ERR_HANDLE(res) MLDC_ERR_HANDLE(res)
return return
end function mld_c_dprecseti end function amg_c_dprecseti
function mld_c_dprecsetr(ph,what,val) bind(c) result(res) function amg_c_dprecsetr(ph,what,val) bind(c) result(res)
use psb_base_mod use psb_base_mod
use mld_prec_mod use amg_prec_mod
implicit none implicit none
integer(psb_c_ipk_) :: res integer(psb_c_ipk_) :: res
@ -96,7 +96,7 @@ contains
real(c_double), value :: val real(c_double), value :: val
integer :: info integer :: info
character(len=80) :: fwhat character(len=80) :: fwhat
type(mld_dprec_type), pointer :: precp type(amg_dprec_type), pointer :: precp
res = -1 res = -1
if (c_associated(ph%item)) then if (c_associated(ph%item)) then
@ -107,16 +107,16 @@ contains
call stringc2f(what,fwhat) call stringc2f(what,fwhat)
call mld_precset(precp,fwhat,val,info) call amg_precset(precp,fwhat,val,info)
res = MLDC_ERR_FILTER(info) res = MLDC_ERR_FILTER(info)
MLDC_ERR_HANDLE(res) MLDC_ERR_HANDLE(res)
return return
end function mld_c_dprecsetr end function amg_c_dprecsetr
function mld_c_dprecsetc(ph,what,val) bind(c) result(res) function amg_c_dprecsetc(ph,what,val) bind(c) result(res)
use psb_base_mod use psb_base_mod
use mld_prec_mod use amg_prec_mod
implicit none implicit none
integer(psb_c_ipk_) :: res integer(psb_c_ipk_) :: res
@ -124,7 +124,7 @@ contains
character(c_char) :: what(*), val(*) character(c_char) :: what(*), val(*)
integer :: info integer :: info
character(len=80) :: fwhat,fval character(len=80) :: fwhat,fval
type(mld_dprec_type), pointer :: precp type(amg_dprec_type), pointer :: precp
res = -1 res = -1
if (c_associated(ph%item)) then if (c_associated(ph%item)) then
@ -136,22 +136,22 @@ contains
call stringc2f(what,fwhat) call stringc2f(what,fwhat)
call stringc2f(val,fval) call stringc2f(val,fval)
call mld_precset(precp,fwhat,fval,info) call amg_precset(precp,fwhat,fval,info)
res = MLDC_ERR_FILTER(info) res = MLDC_ERR_FILTER(info)
MLDC_ERR_HANDLE(res) MLDC_ERR_HANDLE(res)
return return
end function mld_c_dprecsetc end function amg_c_dprecsetc
function mld_c_dprecbld(ah,cdh,ph) bind(c) result(res) function amg_c_dprecbld(ah,cdh,ph) bind(c) result(res)
use psb_base_mod use psb_base_mod
use mld_prec_mod use amg_prec_mod
implicit none implicit none
integer(psb_c_ipk_) :: res integer(psb_c_ipk_) :: res
type(psb_c_object_type) :: ph,ah,cdh type(psb_c_object_type) :: ph,ah,cdh
integer :: info integer :: info
type(mld_dprec_type), pointer :: precp type(amg_dprec_type), pointer :: precp
type(psb_dspmat_type), pointer :: ap type(psb_dspmat_type), pointer :: ap
type(psb_desc_type), pointer :: descp type(psb_desc_type), pointer :: descp
character(len=80) :: fptype character(len=80) :: fptype
@ -174,23 +174,23 @@ contains
return return
end if end if
call mld_precbld(ap,descp,precp,info) call amg_precbld(ap,descp,precp,info)
res = MLDC_ERR_FILTER(info) res = MLDC_ERR_FILTER(info)
MLDC_ERR_HANDLE(res) MLDC_ERR_HANDLE(res)
return return
end function mld_c_dprecbld end function amg_c_dprecbld
function mld_c_dhierarchy_build(ah,cdh,ph) bind(c) result(res) function amg_c_dhierarchy_build(ah,cdh,ph) bind(c) result(res)
use psb_base_mod use psb_base_mod
use mld_prec_mod use amg_prec_mod
implicit none implicit none
integer(psb_c_ipk_) :: res integer(psb_c_ipk_) :: res
type(psb_c_object_type) :: ph,ah,cdh type(psb_c_object_type) :: ph,ah,cdh
integer :: info integer :: info
type(mld_dprec_type), pointer :: precp type(amg_dprec_type), pointer :: precp
type(psb_dspmat_type), pointer :: ap type(psb_dspmat_type), pointer :: ap
type(psb_desc_type), pointer :: descp type(psb_desc_type), pointer :: descp
character(len=80) :: fptype character(len=80) :: fptype
@ -219,17 +219,17 @@ contains
MLDC_ERR_HANDLE(res) MLDC_ERR_HANDLE(res)
return return
end function mld_c_dhierarchy_build end function amg_c_dhierarchy_build
function mld_c_dsmoothers_build(ah,cdh,ph) bind(c) result(res) function amg_c_dsmoothers_build(ah,cdh,ph) bind(c) result(res)
use psb_base_mod use psb_base_mod
use mld_prec_mod use amg_prec_mod
implicit none implicit none
integer(psb_c_ipk_) :: res integer(psb_c_ipk_) :: res
type(psb_c_object_type) :: ph,ah,cdh type(psb_c_object_type) :: ph,ah,cdh
integer :: info integer :: info
type(mld_dprec_type), pointer :: precp type(amg_dprec_type), pointer :: precp
type(psb_dspmat_type), pointer :: ap type(psb_dspmat_type), pointer :: ap
type(psb_desc_type), pointer :: descp type(psb_desc_type), pointer :: descp
character(len=80) :: fptype character(len=80) :: fptype
@ -258,9 +258,9 @@ contains
MLDC_ERR_HANDLE(res) MLDC_ERR_HANDLE(res)
return return
end function mld_c_dsmoothers_build end function amg_c_dsmoothers_build
function mld_c_dkrylov(methd,& function amg_c_dkrylov(methd,&
& ah,ph,bh,xh,cdh,options) bind(c) result(res) & ah,ph,bh,xh,cdh,options) bind(c) result(res)
use psb_base_mod use psb_base_mod
use psb_prec_mod use psb_prec_mod
@ -273,15 +273,15 @@ contains
character(c_char) :: methd(*) character(c_char) :: methd(*)
type(solveroptions) :: options type(solveroptions) :: options
res= mld_c_dkrylov_opt(methd, ah, ph, bh, xh, options%eps,cdh, & res= amg_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,&
& irst=options%irst, err=options%err) & irst=options%irst, err=options%err)
end function mld_c_dkrylov end function amg_c_dkrylov
function mld_c_dkrylov_opt(methd,& function amg_c_dkrylov_opt(methd,&
& ah,ph,bh,xh,eps,cdh,itmax,iter,err,itrace,irst,istop) bind(c) result(res) & ah,ph,bh,xh,eps,cdh,itmax,iter,err,itrace,irst,istop) bind(c) result(res)
use psb_base_mod use psb_base_mod
use psb_prec_mod use psb_prec_mod
@ -299,7 +299,7 @@ contains
character(c_char) :: methd(*) character(c_char) :: methd(*)
type(psb_desc_type), pointer :: descp type(psb_desc_type), pointer :: descp
type(psb_dspmat_type), pointer :: ap type(psb_dspmat_type), pointer :: ap
type(mld_dprec_type), pointer :: precp type(amg_dprec_type), pointer :: precp
type(psb_d_vect_type), pointer :: xp, bp type(psb_d_vect_type), pointer :: xp, bp
integer :: info,fitmax,fitrace,first,fistop,fiter integer :: info,fitmax,fitrace,first,fistop,fiter
@ -349,17 +349,17 @@ contains
err = ferr err = ferr
res = min(info,0) res = min(info,0)
end function mld_c_dkrylov_opt end function amg_c_dkrylov_opt
function mld_c_dprecfree(ph) bind(c) result(res) function amg_c_dprecfree(ph) bind(c) result(res)
use psb_base_mod use psb_base_mod
use mld_prec_mod use amg_prec_mod
implicit none implicit none
integer(psb_c_ipk_) :: res integer(psb_c_ipk_) :: res
type(psb_c_object_type) :: ph type(psb_c_object_type) :: ph
integer :: info integer :: info
type(mld_dprec_type), pointer :: precp type(amg_dprec_type), pointer :: precp
character(len=80) :: fptype character(len=80) :: fptype
res = -1 res = -1
@ -375,17 +375,17 @@ contains
res = MLDC_ERR_FILTER(info) res = MLDC_ERR_FILTER(info)
MLDC_ERR_HANDLE(res) MLDC_ERR_HANDLE(res)
return return
end function mld_c_dprecfree end function amg_c_dprecfree
function mld_c_ddescr(ph) bind(c) result(res) function amg_c_ddescr(ph) bind(c) result(res)
use psb_base_mod use psb_base_mod
use mld_prec_mod use amg_prec_mod
implicit none implicit none
integer(psb_c_ipk_) :: res integer(psb_c_ipk_) :: res
type(psb_c_object_type) :: ph type(psb_c_object_type) :: ph
integer :: info integer :: info
type(mld_dprec_type), pointer :: precp type(amg_dprec_type), pointer :: precp
res = -1 res = -1
info = -1 info = -1
@ -403,6 +403,6 @@ contains
res = MLDC_ERR_FILTER(info) res = MLDC_ERR_FILTER(info)
MLDC_ERR_HANDLE(res) MLDC_ERR_HANDLE(res)
return return
end function mld_c_ddescr end function amg_c_ddescr
end module mld_dprec_cbind_mod end module amg_dprec_cbind_mod

@ -1,9 +1,9 @@
module mld_prec_cbind_mod module amg_prec_cbind_mod
use iso_c_binding use iso_c_binding
use psb_base_cbind_mod use psb_base_cbind_mod
use psb_prec_cbind_mod use psb_prec_cbind_mod
use mld_dprec_cbind_mod use amg_dprec_cbind_mod
use mld_zprec_cbind_mod use amg_zprec_cbind_mod
end module mld_prec_cbind_mod end module amg_prec_cbind_mod

@ -1,12 +1,12 @@
module mld_zprec_cbind_mod module amg_zprec_cbind_mod
use iso_c_binding use iso_c_binding
use mld_prec_mod use amg_prec_mod
use psb_base_cbind_mod use psb_base_cbind_mod
type, bind(c) :: mld_c_zprec type, bind(c) :: amg_c_zprec
type(c_ptr) :: item = c_null_ptr type(c_ptr) :: item = c_null_ptr
end type mld_c_zprec end type amg_c_zprec
contains contains
@ -17,22 +17,22 @@ contains
#define MLDC_DEBUG(MSG) #define MLDC_DEBUG(MSG)
#define MLDC_ERROR(MSG) #define MLDC_ERROR(MSG)
#endif #endif
#define mld_success_ 0 #define amg_success_ 0
!#define MLDC_ERR_FILTER(INFO) min(0,INFO) !#define MLDC_ERR_FILTER(INFO) min(0,INFO)
#define MLDC_ERR_FILTER(INFO) (INFO) #define MLDC_ERR_FILTER(INFO) (INFO)
#define MLDC_ERR_HANDLE(INFO) if(INFO/=mld_success_)MLDC_ERROR("ERROR!") #define MLDC_ERR_HANDLE(INFO) if(INFO/=amg_success_)MLDC_ERROR("ERROR!")
function mld_c_zprecinit(cctxt,ph,ptype) bind(c) result(res) function amg_c_zprecinit(cctxt,ph,ptype) bind(c) result(res)
use psb_base_mod use psb_base_mod
use mld_prec_mod use amg_prec_mod
implicit none implicit none
integer(psb_c_ipk_) :: res integer(psb_c_ipk_) :: res
type(mld_c_zprec) :: ph type(amg_c_zprec) :: ph
integer(psb_c_ipk_), value :: cctxt integer(psb_c_ipk_), value :: cctxt
character(c_char) :: ptype(*) character(c_char) :: ptype(*)
integer :: info integer :: info
type(mld_zprec_type), pointer :: precp type(amg_zprec_type), pointer :: precp
character(len=80) :: fptype character(len=80) :: fptype
res = -1 res = -1
@ -48,16 +48,16 @@ contains
call stringc2f(ptype,fptype) call stringc2f(ptype,fptype)
call precp%init(cctxt,fptype,info) call precp%init(psb_c2f_ctxt(cctxt),fptype,info)
res = MLDC_ERR_FILTER(info) res = MLDC_ERR_FILTER(info)
MLDC_ERR_HANDLE(res) MLDC_ERR_HANDLE(res)
return return
end function mld_c_zprecinit end function amg_c_zprecinit
function mld_c_zprecseti(ph,what,val) bind(c) result(res) function amg_c_zprecseti(ph,what,val) bind(c) result(res)
use psb_base_mod use psb_base_mod
use mld_prec_mod use amg_prec_mod
implicit none implicit none
integer(psb_c_ipk_) :: res integer(psb_c_ipk_) :: res
@ -66,7 +66,7 @@ contains
integer(psb_c_ipk_), value :: val integer(psb_c_ipk_), value :: val
integer :: info integer :: info
character(len=80) :: fwhat character(len=80) :: fwhat
type(mld_zprec_type), pointer :: precp type(amg_zprec_type), pointer :: precp
res = -1 res = -1
if (c_associated(ph%item)) then if (c_associated(ph%item)) then
@ -77,17 +77,17 @@ contains
call stringc2f(what,fwhat) call stringc2f(what,fwhat)
call mld_precset(precp,fwhat,val,info) call amg_precset(precp,fwhat,val,info)
res = MLDC_ERR_FILTER(info) res = MLDC_ERR_FILTER(info)
MLDC_ERR_HANDLE(res) MLDC_ERR_HANDLE(res)
return return
end function mld_c_zprecseti end function amg_c_zprecseti
function mld_c_zprecsetr(ph,what,val) bind(c) result(res) function amg_c_zprecsetr(ph,what,val) bind(c) result(res)
use psb_base_mod use psb_base_mod
use mld_prec_mod use amg_prec_mod
implicit none implicit none
integer(psb_c_ipk_) :: res integer(psb_c_ipk_) :: res
@ -96,7 +96,7 @@ contains
real(c_double), value :: val real(c_double), value :: val
integer :: info integer :: info
character(len=80) :: fwhat character(len=80) :: fwhat
type(mld_zprec_type), pointer :: precp type(amg_zprec_type), pointer :: precp
res = -1 res = -1
if (c_associated(ph%item)) then if (c_associated(ph%item)) then
@ -107,16 +107,16 @@ contains
call stringc2f(what,fwhat) call stringc2f(what,fwhat)
call mld_precset(precp,fwhat,val,info) call amg_precset(precp,fwhat,val,info)
res = MLDC_ERR_FILTER(info) res = MLDC_ERR_FILTER(info)
MLDC_ERR_HANDLE(res) MLDC_ERR_HANDLE(res)
return return
end function mld_c_zprecsetr end function amg_c_zprecsetr
function mld_c_zprecsetc(ph,what,val) bind(c) result(res) function amg_c_zprecsetc(ph,what,val) bind(c) result(res)
use psb_base_mod use psb_base_mod
use mld_prec_mod use amg_prec_mod
implicit none implicit none
integer(psb_c_ipk_) :: res integer(psb_c_ipk_) :: res
@ -124,7 +124,7 @@ contains
character(c_char) :: what(*), val(*) character(c_char) :: what(*), val(*)
integer :: info integer :: info
character(len=80) :: fwhat,fval character(len=80) :: fwhat,fval
type(mld_zprec_type), pointer :: precp type(amg_zprec_type), pointer :: precp
res = -1 res = -1
if (c_associated(ph%item)) then if (c_associated(ph%item)) then
@ -136,22 +136,22 @@ contains
call stringc2f(what,fwhat) call stringc2f(what,fwhat)
call stringc2f(val,fval) call stringc2f(val,fval)
call mld_precset(precp,fwhat,fval,info) call amg_precset(precp,fwhat,fval,info)
res = MLDC_ERR_FILTER(info) res = MLDC_ERR_FILTER(info)
MLDC_ERR_HANDLE(res) MLDC_ERR_HANDLE(res)
return return
end function mld_c_zprecsetc end function amg_c_zprecsetc
function mld_c_zprecbld(ah,cdh,ph) bind(c) result(res) function amg_c_zprecbld(ah,cdh,ph) bind(c) result(res)
use psb_base_mod use psb_base_mod
use mld_prec_mod use amg_prec_mod
implicit none implicit none
integer(psb_c_ipk_) :: res integer(psb_c_ipk_) :: res
type(psb_c_object_type) :: ph,ah,cdh type(psb_c_object_type) :: ph,ah,cdh
integer :: info integer :: info
type(mld_zprec_type), pointer :: precp type(amg_zprec_type), pointer :: precp
type(psb_zspmat_type), pointer :: ap type(psb_zspmat_type), pointer :: ap
type(psb_desc_type), pointer :: descp type(psb_desc_type), pointer :: descp
character(len=80) :: fptype character(len=80) :: fptype
@ -174,23 +174,23 @@ contains
return return
end if end if
call mld_precbld(ap,descp,precp,info) call amg_precbld(ap,descp,precp,info)
res = MLDC_ERR_FILTER(info) res = MLDC_ERR_FILTER(info)
MLDC_ERR_HANDLE(res) MLDC_ERR_HANDLE(res)
return return
end function mld_c_zprecbld end function amg_c_zprecbld
function mld_c_zhierarchy_build(ah,cdh,ph) bind(c) result(res) function amg_c_zhierarchy_build(ah,cdh,ph) bind(c) result(res)
use psb_base_mod use psb_base_mod
use mld_prec_mod use amg_prec_mod
implicit none implicit none
integer(psb_c_ipk_) :: res integer(psb_c_ipk_) :: res
type(psb_c_object_type) :: ph,ah,cdh type(psb_c_object_type) :: ph,ah,cdh
integer :: info integer :: info
type(mld_zprec_type), pointer :: precp type(amg_zprec_type), pointer :: precp
type(psb_zspmat_type), pointer :: ap type(psb_zspmat_type), pointer :: ap
type(psb_desc_type), pointer :: descp type(psb_desc_type), pointer :: descp
character(len=80) :: fptype character(len=80) :: fptype
@ -219,17 +219,17 @@ contains
MLDC_ERR_HANDLE(res) MLDC_ERR_HANDLE(res)
return return
end function mld_c_zhierarchy_build end function amg_c_zhierarchy_build
function mld_c_zsmoothers_build(ah,cdh,ph) bind(c) result(res) function amg_c_zsmoothers_build(ah,cdh,ph) bind(c) result(res)
use psb_base_mod use psb_base_mod
use mld_prec_mod use amg_prec_mod
implicit none implicit none
integer(psb_c_ipk_) :: res integer(psb_c_ipk_) :: res
type(psb_c_object_type) :: ph,ah,cdh type(psb_c_object_type) :: ph,ah,cdh
integer :: info integer :: info
type(mld_zprec_type), pointer :: precp type(amg_zprec_type), pointer :: precp
type(psb_zspmat_type), pointer :: ap type(psb_zspmat_type), pointer :: ap
type(psb_desc_type), pointer :: descp type(psb_desc_type), pointer :: descp
character(len=80) :: fptype character(len=80) :: fptype
@ -258,9 +258,9 @@ contains
MLDC_ERR_HANDLE(res) MLDC_ERR_HANDLE(res)
return return
end function mld_c_zsmoothers_build end function amg_c_zsmoothers_build
function mld_c_zkrylov(methd,& function amg_c_zkrylov(methd,&
& ah,ph,bh,xh,cdh,options) bind(c) result(res) & ah,ph,bh,xh,cdh,options) bind(c) result(res)
use psb_base_mod use psb_base_mod
use psb_prec_mod use psb_prec_mod
@ -273,15 +273,15 @@ contains
character(c_char) :: methd(*) character(c_char) :: methd(*)
type(solveroptions) :: options type(solveroptions) :: options
res= mld_c_zkrylov_opt(methd, ah, ph, bh, xh, options%eps,cdh, & res= amg_c_zkrylov_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,&
& irst=options%irst, err=options%err) & irst=options%irst, err=options%err)
end function mld_c_zkrylov end function amg_c_zkrylov
function mld_c_zkrylov_opt(methd,& function amg_c_zkrylov_opt(methd,&
& ah,ph,bh,xh,eps,cdh,itmax,iter,err,itrace,irst,istop) bind(c) result(res) & ah,ph,bh,xh,eps,cdh,itmax,iter,err,itrace,irst,istop) bind(c) result(res)
use psb_base_mod use psb_base_mod
use psb_prec_mod use psb_prec_mod
@ -299,7 +299,7 @@ contains
character(c_char) :: methd(*) character(c_char) :: methd(*)
type(psb_desc_type), pointer :: descp type(psb_desc_type), pointer :: descp
type(psb_zspmat_type), pointer :: ap type(psb_zspmat_type), pointer :: ap
type(mld_zprec_type), pointer :: precp type(amg_zprec_type), pointer :: precp
type(psb_z_vect_type), pointer :: xp, bp type(psb_z_vect_type), pointer :: xp, bp
integer :: info,fitmax,fitrace,first,fistop,fiter integer :: info,fitmax,fitrace,first,fistop,fiter
@ -349,17 +349,17 @@ contains
err = ferr err = ferr
res = min(info,0) res = min(info,0)
end function mld_c_zkrylov_opt end function amg_c_zkrylov_opt
function mld_c_zprecfree(ph) bind(c) result(res) function amg_c_zprecfree(ph) bind(c) result(res)
use psb_base_mod use psb_base_mod
use mld_prec_mod use amg_prec_mod
implicit none implicit none
integer(psb_c_ipk_) :: res integer(psb_c_ipk_) :: res
type(psb_c_object_type) :: ph type(psb_c_object_type) :: ph
integer :: info integer :: info
type(mld_zprec_type), pointer :: precp type(amg_zprec_type), pointer :: precp
character(len=80) :: fptype character(len=80) :: fptype
res = -1 res = -1
@ -375,17 +375,17 @@ contains
res = MLDC_ERR_FILTER(info) res = MLDC_ERR_FILTER(info)
MLDC_ERR_HANDLE(res) MLDC_ERR_HANDLE(res)
return return
end function mld_c_zprecfree end function amg_c_zprecfree
function mld_c_zdescr(ph) bind(c) result(res) function amg_c_zdescr(ph) bind(c) result(res)
use psb_base_mod use psb_base_mod
use mld_prec_mod use amg_prec_mod
implicit none implicit none
integer(psb_c_ipk_) :: res integer(psb_c_ipk_) :: res
type(psb_c_object_type) :: ph type(psb_c_object_type) :: ph
integer :: info integer :: info
type(mld_zprec_type), pointer :: precp type(amg_zprec_type), pointer :: precp
res = -1 res = -1
info = -1 info = -1
@ -403,6 +403,6 @@ contains
res = MLDC_ERR_FILTER(info) res = MLDC_ERR_FILTER(info)
MLDC_ERR_HANDLE(res) MLDC_ERR_HANDLE(res)
return return
end function mld_c_zdescr end function amg_c_zdescr
end module mld_zprec_cbind_mod end module amg_zprec_cbind_mod

Loading…
Cancel
Save