/[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 96 by jgs, Tue Oct 26 06:53:54 2004 UTC revision 97 by jgs, Tue Dec 14 05:39:33 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);
28           MEMFREE(prec->pivot);
29         MEMFREE(prec->color);         MEMFREE(prec->color);
30         MEMFREE(prec);         MEMFREE(prec);
31      }      }
# Line 37  void Finley_Solver_setPreconditioner(Fin Line 38  void Finley_Solver_setPreconditioner(Fin
38      Finley_Solver_Preconditioner* prec=NULL;      Finley_Solver_Preconditioner* prec=NULL;
39      if (A->iterative==NULL) {      if (A->iterative==NULL) {
40          /* allocate structure to hold preconditioner */          /* allocate structure to hold preconditioner */
41          prec=(Finley_Solver_Preconditioner*) MEMALLOC(sizeof(Finley_Solver_Preconditioner));          prec=MEMALLOC(1,Finley_Solver_Preconditioner);
42          if (Finley_checkPtr(prec)) return;          if (Finley_checkPtr(prec)) return;
43          prec->type=UNKNOWN;          prec->type=UNKNOWN;
         prec->values=NULL;  
44          prec->numColors=0;          prec->numColors=0;
45    
46            prec->values=NULL;
47          prec->mainDiag=NULL;          prec->mainDiag=NULL;
48            prec->pivot=NULL;
49          prec->color=NULL;          prec->color=NULL;
50    
51          A->iterative=prec;          A->iterative=prec;
52          switch (options->preconditioner) {          switch (options->preconditioner) {
53             default:             default:
54                printf("Information: Unsupported preconditioner selected. ILU0 is used.\n");             case ESCRIPT_JACOBI:
55             case ILU0:                if (options->verbose) printf("Jacobi preconditioner is used.\n");
               Finley_Solver_setILU0(A);  
               prec->type=ILU0;  
               break;  
            case JACOBI:  
56                Finley_Solver_setJacobi(A);                Finley_Solver_setJacobi(A);
57                prec->type=JACOBI;                prec->type=ESCRIPT_JACOBI;
58                  break;
59               case ESCRIPT_ILU0:
60                  if (options->verbose) printf("ILU(0) preconditioner is used.\n");
61                  Finley_Solver_setILU0(A);
62                  prec->type=ESCRIPT_ILU0;
63                break;                break;
64          }          }
65          if (Finley_ErrorCode!=NO_ERROR) {          if (Finley_ErrorCode!=NO_ERROR) {
# Line 73  void Finley_Solver_solvePreconditioner(F Line 78  void Finley_Solver_solvePreconditioner(F
78      Finley_Solver_Preconditioner* prec=(Finley_Solver_Preconditioner*) A->iterative;      Finley_Solver_Preconditioner* prec=(Finley_Solver_Preconditioner*) A->iterative;
79      #pragma omp barrier      #pragma omp barrier
80      switch (prec->type) {      switch (prec->type) {
81          case ILU0:          default:
82             Finley_Solver_solveILU0(A,x,b);          case ESCRIPT_JACOBI:
            break;  
         case JACOBI:  
83             Finley_Solver_solveJacobi(A,x,b);             Finley_Solver_solveJacobi(A,x,b);
84             break;             break;
85          default:          case ESCRIPT_ILU0:
86             Finley_ErrorCode=TYPE_ERROR;             Finley_Solver_solveILU0(A,x,b);
87             sprintf(Finley_ErrorMsg,"Unknown preconditioner type.");             break;
88      }      }
89  #endif  #endif
90    
# Line 89  void Finley_Solver_solvePreconditioner(F Line 92  void Finley_Solver_solvePreconditioner(F
92    
93  /*  /*
94  * $Log$  * $Log$
95  * Revision 1.1  2004/10/26 06:53:58  jgs  * Revision 1.2  2004/12/14 05:39:32  jgs
96  * Initial revision  * *** empty log message ***
97    *
98    * Revision 1.1.1.1.2.2  2004/11/24 01:37:17  gross
99    * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
100    *
101    * Revision 1.1.1.1.2.1  2004/11/12 06:58:21  gross
102    * 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
103    *
104    * Revision 1.1.1.1  2004/10/26 06:53:58  jgs
105    * initial import of project esys2
106  *  *
107  * Revision 1.1  2004/07/02 04:21:14  gross  * Revision 1.1  2004/07/02 04:21:14  gross
108  * Finley C code has been included  * Finley C code has been included

Legend:
Removed from v.96  
changed lines
  Added in v.97

  ViewVC Help
Powered by ViewVC 1.1.26