52 #include "az_ifpack.h"
53 void AZ_ifpack_prec_create(
double *x,
double *b,
54 int *options,
double *params,
56 AZ_MATRIX *Amat, AZ_PRECOND **Prec)
60 int nr, nc, *data_org;
61 double rthresh, athresh;
64 az2ifp_blockmatrix(&bmat, Amat);
68 if (options[AZ_precond] == AZ_none)
69 ifp_preconditioner(&precon, bmat, IFP_NONE,
70 (
double) options[AZ_graph_fill], 0.0,
71 IFP_INVERSE, 0.0, 0.0);
73 else if (options[AZ_precond] == AZ_Jacobi)
75 rthresh = params[AZ_rthresh];
76 athresh = params[AZ_athresh];
77 ifp_preconditioner(&precon, bmat, IFP_BJACOBI, 0.0, 0.0,
78 IFP_SVD, rthresh, athresh);
82 else if (options[AZ_precond] == AZ_dom_decomp &&
83 options[AZ_subdomain_solve] == AZ_bilu_ifp)
85 rthresh = params[AZ_rthresh];
86 athresh = params[AZ_athresh];
87 ifp_preconditioner(&precon, bmat,
88 IFP_BILUK, (
double) options[AZ_graph_fill], 0.0,
89 IFP_SVD, rthresh, athresh);
95 printf(
"Not a supported preconditioner in az_ifpack_prec_create\n");
99 (*Prec) = AZ_precond_create(Amat,AZ_ifpack_precon,NULL);
103 Prec_pass_data->precon = precon;
104 Prec_pass_data->bmat = bmat;
109 data_org = Amat->data_org;
110 nr = data_org[AZ_N_internal] + data_org[AZ_N_border];
114 Prec_pass_data->nr = nr;
115 Prec_pass_data->nc = nc;
116 (*Prec)->Pmat = Amat;
117 Prec_pass_data->user_aux_ptr = (*Prec)->Pmat->aux_ptr;
118 (*Prec)->Pmat->aux_ptr = (
void *) Prec_pass_data;
119 (*Prec)->prec_function = AZ_ifpack_precon;
120 Prec_pass_data->user_precon = options[AZ_precond];
121 options[AZ_precond] = AZ_user_precond;