1 |
/* $Id$ */ |
/* $Id$ */ |
2 |
|
|
3 |
|
|
4 |
|
/* |
5 |
|
******************************************************************************** |
6 |
|
* Copyright © 2006 by ACcESS MNRF * |
7 |
|
* * |
8 |
|
* http://www.access.edu.au * |
9 |
|
* Primary Business: Queensland, Australia * |
10 |
|
* Licensed under the Open Software License version 3.0 * |
11 |
|
* http://www.opensource.org/licenses/osl-3.0.php * |
12 |
|
******************************************************************************** |
13 |
|
*/ |
14 |
|
|
15 |
/**************************************************************/ |
/**************************************************************/ |
16 |
|
|
17 |
/* Paso: SystemMatrix: sets-up the preconditioner */ |
/* Paso: SystemMatrix: sets-up the preconditioner */ |
34 |
void Paso_Preconditioner_free(Paso_Solver_Preconditioner* in) { |
void Paso_Preconditioner_free(Paso_Solver_Preconditioner* in) { |
35 |
if (in!=NULL) { |
if (in!=NULL) { |
36 |
Paso_Solver_ILU_free(in->ilu); |
Paso_Solver_ILU_free(in->ilu); |
37 |
|
Paso_Solver_RILU_free(in->rilu); |
38 |
Paso_Solver_Jacobi_free(in->jacobi); |
Paso_Solver_Jacobi_free(in->jacobi); |
39 |
MEMFREE(in); |
MEMFREE(in); |
40 |
} |
} |
48 |
prec=MEMALLOC(1,Paso_Solver_Preconditioner); |
prec=MEMALLOC(1,Paso_Solver_Preconditioner); |
49 |
if (Paso_checkPtr(prec)) return; |
if (Paso_checkPtr(prec)) return; |
50 |
prec->type=UNKNOWN; |
prec->type=UNKNOWN; |
51 |
|
prec->rilu=NULL; |
52 |
prec->ilu=NULL; |
prec->ilu=NULL; |
53 |
prec->jacobi=NULL; |
prec->jacobi=NULL; |
54 |
A->solver=prec; |
A->solver=prec; |
64 |
prec->ilu=Paso_Solver_getILU(A,options->verbose); |
prec->ilu=Paso_Solver_getILU(A,options->verbose); |
65 |
prec->type=PASO_ILU0; |
prec->type=PASO_ILU0; |
66 |
break; |
break; |
67 |
|
case PASO_RILU: |
68 |
|
if (options->verbose) printf("RILU preconditioner is used.\n"); |
69 |
|
prec->rilu=Paso_Solver_getRILU(A,options->verbose); |
70 |
|
prec->type=PASO_RILU; |
71 |
|
break; |
72 |
} |
} |
73 |
if (! Paso_noError()) { |
if (! Paso_noError()) { |
74 |
Paso_Preconditioner_free(prec); |
Paso_Preconditioner_free(prec); |
91 |
case PASO_ILU0: |
case PASO_ILU0: |
92 |
Paso_Solver_solveILU(prec->ilu,x,b); |
Paso_Solver_solveILU(prec->ilu,x,b); |
93 |
break; |
break; |
94 |
|
case PASO_RILU: |
95 |
|
Paso_Solver_solveRILU(prec->rilu,x,b); |
96 |
|
break; |
97 |
} |
} |
98 |
} |
} |
99 |
|
|