22 |
void Paso_Preconditioner_free(Paso_Solver_Preconditioner* in) { |
void Paso_Preconditioner_free(Paso_Solver_Preconditioner* in) { |
23 |
if (in!=NULL) { |
if (in!=NULL) { |
24 |
Paso_Solver_ILU_free(in->ilu); |
Paso_Solver_ILU_free(in->ilu); |
25 |
|
Paso_Solver_RILU_free(in->rilu); |
26 |
Paso_Solver_Jacobi_free(in->jacobi); |
Paso_Solver_Jacobi_free(in->jacobi); |
27 |
MEMFREE(in); |
MEMFREE(in); |
28 |
} |
} |
36 |
prec=MEMALLOC(1,Paso_Solver_Preconditioner); |
prec=MEMALLOC(1,Paso_Solver_Preconditioner); |
37 |
if (Paso_checkPtr(prec)) return; |
if (Paso_checkPtr(prec)) return; |
38 |
prec->type=UNKNOWN; |
prec->type=UNKNOWN; |
39 |
|
prec->rilu=NULL; |
40 |
prec->ilu=NULL; |
prec->ilu=NULL; |
41 |
prec->jacobi=NULL; |
prec->jacobi=NULL; |
42 |
A->solver=prec; |
A->solver=prec; |
52 |
prec->ilu=Paso_Solver_getILU(A,options->verbose); |
prec->ilu=Paso_Solver_getILU(A,options->verbose); |
53 |
prec->type=PASO_ILU0; |
prec->type=PASO_ILU0; |
54 |
break; |
break; |
55 |
|
case PASO_RILU: |
56 |
|
if (options->verbose) printf("RILU preconditioner is used.\n"); |
57 |
|
prec->ilu=Paso_Solver_getRILU(A,options->verbose); |
58 |
|
prec->type=PASO_RILU; |
59 |
|
break; |
60 |
} |
} |
61 |
if (! Paso_noError()) { |
if (! Paso_noError()) { |
62 |
Paso_Preconditioner_free(prec); |
Paso_Preconditioner_free(prec); |
79 |
case PASO_ILU0: |
case PASO_ILU0: |
80 |
Paso_Solver_solveILU(prec->ilu,x,b); |
Paso_Solver_solveILU(prec->ilu,x,b); |
81 |
break; |
break; |
82 |
|
case PASO_RILU: |
83 |
|
Paso_Solver_solveRILU(prec->rilu,x,b); |
84 |
|
break; |
85 |
} |
} |
86 |
} |
} |
87 |
|
|