30 |
|
|
31 |
void Paso_Solver_setPreconditioner(Paso_SystemMatrix* A,Paso_Options* options) { |
void Paso_Solver_setPreconditioner(Paso_SystemMatrix* A,Paso_Options* options) { |
32 |
Paso_Solver_Preconditioner* prec=NULL; |
Paso_Solver_Preconditioner* prec=NULL; |
33 |
if (A->iterative==NULL) { |
if (A->solver==NULL) { |
34 |
/* allocate structure to hold preconditioner */ |
/* allocate structure to hold preconditioner */ |
35 |
prec=MEMALLOC(1,Paso_Solver_Preconditioner); |
prec=MEMALLOC(1,Paso_Solver_Preconditioner); |
36 |
if (Paso_checkPtr(prec)) return; |
if (Paso_checkPtr(prec)) return; |
37 |
prec->type=UNKNOWN; |
prec->type=UNKNOWN; |
38 |
prec->ilu=NULL; |
prec->ilu=NULL; |
39 |
prec->jacobi=NULL; |
prec->jacobi=NULL; |
40 |
A->iterative=prec; |
A->solver=prec; |
41 |
switch (options->preconditioner) { |
switch (options->preconditioner) { |
42 |
default: |
default: |
43 |
case PASO_JACOBI: |
case PASO_JACOBI: |
53 |
} |
} |
54 |
if (! Paso_noError()) { |
if (! Paso_noError()) { |
55 |
Paso_Preconditioner_free(prec); |
Paso_Preconditioner_free(prec); |
56 |
A->iterative=NULL; |
A->solver=NULL; |
57 |
} |
} |
58 |
} |
} |
59 |
} |
} |
62 |
/* has to be called within a parallel reqion */ |
/* has to be called within a parallel reqion */ |
63 |
/* barrier synchronization is performed before the evaluation to make sure that the input vector is available */ |
/* barrier synchronization is performed before the evaluation to make sure that the input vector is available */ |
64 |
void Paso_Solver_solvePreconditioner(Paso_SystemMatrix* A,double* x,double* b){ |
void Paso_Solver_solvePreconditioner(Paso_SystemMatrix* A,double* x,double* b){ |
65 |
Paso_Solver_Preconditioner* prec=(Paso_Solver_Preconditioner*) A->iterative; |
Paso_Solver_Preconditioner* prec=(Paso_Solver_Preconditioner*) A->solver; |
66 |
#pragma omp barrier |
#pragma omp barrier |
67 |
switch (prec->type) { |
switch (prec->type) { |
68 |
default: |
default: |