--- trunk/esys2/paso/src/Solvers/Solver_preconditioner.c 2005/09/15 03:44:45 150 +++ trunk/paso/src/Solvers/Solver_preconditioner.c 2006/03/23 05:37:00 633 @@ -1,5 +1,17 @@ /* $Id$ */ + +/* +******************************************************************************** +* Copyright 2006 by ACcESS MNRF * +* * +* http://www.access.edu.au * +* Primary Business: Queensland, Australia * +* Licensed under the Open Software License version 3.0 * +* http://www.opensource.org/licenses/osl-3.0.php * +******************************************************************************** +*/ + /**************************************************************/ /* Paso: SystemMatrix: sets-up the preconditioner */ @@ -22,6 +34,7 @@ void Paso_Preconditioner_free(Paso_Solver_Preconditioner* in) { if (in!=NULL) { Paso_Solver_ILU_free(in->ilu); + Paso_Solver_RILU_free(in->rilu); Paso_Solver_Jacobi_free(in->jacobi); MEMFREE(in); } @@ -30,14 +43,15 @@ void Paso_Solver_setPreconditioner(Paso_SystemMatrix* A,Paso_Options* options) { Paso_Solver_Preconditioner* prec=NULL; - if (A->iterative==NULL) { + if (A->solver==NULL) { /* allocate structure to hold preconditioner */ prec=MEMALLOC(1,Paso_Solver_Preconditioner); if (Paso_checkPtr(prec)) return; prec->type=UNKNOWN; + prec->rilu=NULL; prec->ilu=NULL; prec->jacobi=NULL; - A->iterative=prec; + A->solver=prec; switch (options->preconditioner) { default: case PASO_JACOBI: @@ -50,10 +64,15 @@ prec->ilu=Paso_Solver_getILU(A,options->verbose); prec->type=PASO_ILU0; break; + case PASO_RILU: + if (options->verbose) printf("RILU preconditioner is used.\n"); + prec->rilu=Paso_Solver_getRILU(A,options->verbose); + prec->type=PASO_RILU; + break; } if (! Paso_noError()) { Paso_Preconditioner_free(prec); - A->iterative=NULL; + A->solver=NULL; } } } @@ -62,7 +81,7 @@ /* has to be called within a parallel reqion */ /* barrier synchronization is performed before the evaluation to make sure that the input vector is available */ void Paso_Solver_solvePreconditioner(Paso_SystemMatrix* A,double* x,double* b){ - Paso_Solver_Preconditioner* prec=(Paso_Solver_Preconditioner*) A->iterative; + Paso_Solver_Preconditioner* prec=(Paso_Solver_Preconditioner*) A->solver; #pragma omp barrier switch (prec->type) { default: @@ -72,6 +91,9 @@ case PASO_ILU0: Paso_Solver_solveILU(prec->ilu,x,b); break; + case PASO_RILU: + Paso_Solver_solveRILU(prec->rilu,x,b); + break; } }