/[escript]/trunk/esys2/finley/src/finleyC/Solvers/Solver_preconditioner.c
ViewVC logotype

Diff of /trunk/esys2/finley/src/finleyC/Solvers/Solver_preconditioner.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 99 by jgs, Tue Dec 14 05:39:33 2004 UTC revision 100 by jgs, Wed Dec 15 03:48:48 2004 UTC
# Line 25  void Finley_Preconditioner_free(void* in Line 25  void Finley_Preconditioner_free(void* in
25         Finley_Solver_Preconditioner* prec=(Finley_Solver_Preconditioner*) in;         Finley_Solver_Preconditioner* prec=(Finley_Solver_Preconditioner*) in;
26         MEMFREE(prec->values);         MEMFREE(prec->values);
27         MEMFREE(prec->mainDiag);         MEMFREE(prec->mainDiag);
        MEMFREE(prec->pivot);  
28         MEMFREE(prec->color);         MEMFREE(prec->color);
29         MEMFREE(prec);         MEMFREE(prec);
30      }      }
# Line 38  void Finley_Solver_setPreconditioner(Fin Line 37  void Finley_Solver_setPreconditioner(Fin
37      Finley_Solver_Preconditioner* prec=NULL;      Finley_Solver_Preconditioner* prec=NULL;
38      if (A->iterative==NULL) {      if (A->iterative==NULL) {
39          /* allocate structure to hold preconditioner */          /* allocate structure to hold preconditioner */
40          prec=MEMALLOC(1,Finley_Solver_Preconditioner);          prec=(Finley_Solver_Preconditioner*) MEMALLOC(sizeof(Finley_Solver_Preconditioner));
41          if (Finley_checkPtr(prec)) return;          if (Finley_checkPtr(prec)) return;
42          prec->type=UNKNOWN;          prec->type=UNKNOWN;
         prec->numColors=0;  
   
43          prec->values=NULL;          prec->values=NULL;
44            prec->numColors=0;
45          prec->mainDiag=NULL;          prec->mainDiag=NULL;
         prec->pivot=NULL;  
46          prec->color=NULL;          prec->color=NULL;
   
47          A->iterative=prec;          A->iterative=prec;
48          switch (options->preconditioner) {          switch (options->preconditioner) {
49             default:             default:
50             case ESCRIPT_JACOBI:                printf("Information: Unsupported preconditioner selected. ILU0 is used.\n");
51                if (options->verbose) printf("Jacobi preconditioner is used.\n");             case ILU0:
               Finley_Solver_setJacobi(A);  
               prec->type=ESCRIPT_JACOBI;  
               break;  
            case ESCRIPT_ILU0:  
               if (options->verbose) printf("ILU(0) preconditioner is used.\n");  
52                Finley_Solver_setILU0(A);                Finley_Solver_setILU0(A);
53                prec->type=ESCRIPT_ILU0;                prec->type=ILU0;
54                  break;
55               case JACOBI:
56                  Finley_Solver_setJacobi(A);
57                  prec->type=JACOBI;
58                break;                break;
59          }          }
60          if (Finley_ErrorCode!=NO_ERROR) {          if (Finley_ErrorCode!=NO_ERROR) {
# Line 78  void Finley_Solver_solvePreconditioner(F Line 73  void Finley_Solver_solvePreconditioner(F
73      Finley_Solver_Preconditioner* prec=(Finley_Solver_Preconditioner*) A->iterative;      Finley_Solver_Preconditioner* prec=(Finley_Solver_Preconditioner*) A->iterative;
74      #pragma omp barrier      #pragma omp barrier
75      switch (prec->type) {      switch (prec->type) {
76          default:          case ILU0:
         case ESCRIPT_JACOBI:  
            Finley_Solver_solveJacobi(A,x,b);  
            break;  
         case ESCRIPT_ILU0:  
77             Finley_Solver_solveILU0(A,x,b);             Finley_Solver_solveILU0(A,x,b);
78             break;             break;
79            case JACOBI:
80               Finley_Solver_solveJacobi(A,x,b);
81               break;
82            default:
83               Finley_ErrorCode=TYPE_ERROR;
84               sprintf(Finley_ErrorMsg,"Unknown preconditioner type.");
85      }      }
86  #endif  #endif
87    
# Line 92  void Finley_Solver_solvePreconditioner(F Line 89  void Finley_Solver_solvePreconditioner(F
89    
90  /*  /*
91  * $Log$  * $Log$
92  * Revision 1.2  2004/12/14 05:39:32  jgs  * Revision 1.3  2004/12/15 03:48:47  jgs
93  * *** empty log message ***  * *** empty log message ***
94  *  *
 * Revision 1.1.1.1.2.2  2004/11/24 01:37:17  gross  
 * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now  
 *  
 * Revision 1.1.1.1.2.1  2004/11/12 06:58:21  gross  
 * a lot of changes to get the linearPDE class running: most important change is that there is no matrix format exposed to the user anymore. the format is chosen by the Domain according to the solver and symmetry  
 *  
95  * Revision 1.1.1.1  2004/10/26 06:53:58  jgs  * Revision 1.1.1.1  2004/10/26 06:53:58  jgs
96  * initial import of project esys2  * initial import of project esys2
97  *  *

Legend:
Removed from v.99  
changed lines
  Added in v.100

  ViewVC Help
Powered by ViewVC 1.1.26