16 #define ccrs_xxt_setup PREFIXED_NAME(crs_xxt_setup)
17 #define ccrs_xxt_solve PREFIXED_NAME(crs_xxt_solve)
18 #define ccrs_xxt_stats PREFIXED_NAME(crs_xxt_stats)
19 #define ccrs_xxt_free PREFIXED_NAME(crs_xxt_free )
25 #define ccrs_amg_setup PREFIXED_NAME(crs_amg_setup)
26 #define ccrs_amg_solve PREFIXED_NAME(crs_amg_solve)
27 #define ccrs_amg_stats PREFIXED_NAME(crs_amg_stats)
28 #define ccrs_amg_free PREFIXED_NAME(crs_amg_free )
30 #define fcrs_setup FORTRAN_NAME(crs_setup,CRS_SETUP)
31 #define fcrs_solve FORTRAN_NAME(crs_solve,CRS_SOLVE)
32 #define fcrs_stats FORTRAN_NAME(crs_stats,CRS_STATS)
33 #define fcrs_free FORTRAN_NAME(crs_free ,CRS_FREE)
35 static struct crs_data **handle_array = 0;
36 static int handle_max = 0;
37 static int handle_n = 0;
38 static int *sid_array;
40 #define CHECK_HANDLE(func) do \
41 if(*handle<0 || *handle>=handle_n || !handle_array[*handle]) \
42 fail(1,__FILE__,__LINE__,func ": invalid handle"); \
45 void fcrs_setup(sint *handle,
const sint *sid,
const MPI_Fint *
comm,
const sint *np,
46 const sint *n,
const slong
id[],
const sint *nz,
47 const sint Ai[],
const sint Aj[],
const double A[],
49 const char *datafname, uint *ierr)
52 if(handle_n==handle_max)
53 handle_max+=handle_max/2+1,
54 handle_array=trealloc(
struct crs_data*,handle_array,handle_max),
55 sid_array=trealloc(
int,sid_array,handle_max);
56 comm_init_check(&c, *comm, *np);
58 sid_array[handle_n]=*sid;
60 switch(sid_array[handle_n]) {
62 *nz,(
const uint*)Ai,(
const uint*)Aj,A,
63 *null_space,&c);
break;
65 *nz,(
const uint*)Ai,(
const uint*)Aj,A,
67 datafname,ierr);
break;
69 *nz,(
const uint*)Ai,(
const uint*)Aj,A,
70 *null_space,&c,param);
break;
77 void fcrs_solve(
const sint *handle,
double x[],
double b[])
80 switch(sid_array[*handle]) {
90 switch(sid_array[*handle]) {
95 handle_array[*handle] = 0;
struct crs_data * ccrs_hypre_setup(uint n, const ulong *id, uint nz, const uint *Ai, const uint *Aj, const double *Av, const uint nullspace, const struct comm *comm, const double *param)
void ccrs_hypre_free(struct crs_data *data)
void ccrs_hypre_solve(double *x, struct crs_data *data, double *b)
#define CHECK_HANDLE(func)