/[escript]/trunk/paso/src/Preconditioner.c
ViewVC logotype

Diff of /trunk/paso/src/Preconditioner.c

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

revision 3312 by gross, Tue Oct 26 07:54:58 2010 UTC revision 3402 by gross, Tue Dec 7 07:36:12 2010 UTC
# Line 73  Paso_Preconditioner* Paso_Preconditioner Line 73  Paso_Preconditioner* Paso_Preconditioner
73          switch (options->preconditioner) {          switch (options->preconditioner) {
74             default:             default:
75             case PASO_JACOBI:             case PASO_JACOBI:
76            if (options->verbose) printf("Paso: Jacobi(%d) preconditioner is used.\n",options->sweeps);            if (options->verbose) printf("Paso_Preconditioner: Jacobi(%d) preconditioner is used.\n",options->sweeps);
77            prec->jacobi=Paso_Preconditioner_Smoother_alloc(A, TRUE, options->use_local_preconditioner, options->verbose);            prec->jacobi=Paso_Preconditioner_Smoother_alloc(A, TRUE, options->use_local_preconditioner, options->verbose);
78                prec->type=PASO_JACOBI;                prec->type=PASO_JACOBI;
79            prec->sweeps=options->sweeps;            prec->sweeps=options->sweeps;
80                break;                break;
81         case PASO_GS:         case PASO_GS:
82            if (options->verbose) printf("Paso: Gauss-Seidel(%d) preconditioner is used.\n",options->sweeps);            if (options->verbose) printf("Paso_Preconditioner: Gauss-Seidel(%d) preconditioner is used.\n",options->sweeps);
83            prec->gs=Paso_Preconditioner_Smoother_alloc(A, FALSE, options->use_local_preconditioner, options->verbose);            prec->gs=Paso_Preconditioner_Smoother_alloc(A, FALSE, options->use_local_preconditioner, options->verbose);
84            prec->type=PASO_GS;            prec->type=PASO_GS;
85            prec->sweeps=options->sweeps;            prec->sweeps=options->sweeps;
86            break;            break;
87         case PASO_AMLI:         case PASO_AMLI:
88         case PASO_AMG:         case PASO_AMG:
89            if (options->verbose) printf("Paso: AMG preconditioner is used.\n");            if (options->verbose) {
90               printf("Paso_Preconditioner: AMG preconditioner is used. Smoother is ");
91               if (options->smoother == PASO_JACOBI) {
92                  printf("Jacobi");
93               } else {
94                  printf("Gauss-Seidel");
95               }
96               printf(" with %d/%d pre/post sweeps.\n",options->pre_sweeps, options->post_sweeps);
97              }
98            prec->localamg=Paso_Preconditioner_LocalAMG_alloc(A->mainBlock,1,options);            prec->localamg=Paso_Preconditioner_LocalAMG_alloc(A->mainBlock,1,options);
99            prec->sweeps=options->sweeps;            prec->sweeps=options->sweeps;
100            /* if NULL is returned (and no error) no AMG has been constructed because the system is too small or not big enough            /* if NULL is returned (and no error) no AMG has been constructed because the system is too small or not big enough
101               we now use the Smoother as a preconditioner                                                                      */               we now use the Smoother as a preconditioner                                                                      */
102            if ( (Esys_noError()) && (prec->localamg == NULL) ) {            if ( Esys_noError() ) {
103           if (options->verbose) {           if (prec->localamg == NULL)  {
104              if (options->smoother == PASO_JACOBI) {               if (options->verbose) {
105              printf("Paso: Jacobi(%d) preconditioner is used.\n",prec->sweeps);              if (options->smoother == PASO_JACOBI) {
106              } else {                 printf("Paso_Preconditioner: Jacobi(%d) preconditioner is used.\n",prec->sweeps);
107                 printf("Paso: Gauss-Seidel(%d) preconditioner is used.\n",prec->sweeps);              } else {
108              }                 printf("PPaso_Preconditioner: Gauss-Seidel(%d) preconditioner is used.\n",prec->sweeps);
109           }              }
110           prec->localamgsubstitute=Paso_Preconditioner_LocalSmoother_alloc(A->mainBlock, (options->smoother == PASO_JACOBI), options->verbose);               }
111                 options->num_level=0;
112                 prec->localamgsubstitute=Paso_Preconditioner_LocalSmoother_alloc(A->mainBlock, (options->smoother == PASO_JACOBI), options->verbose);
113              } else {
114                 options->num_level=Paso_Preconditioner_LocalAMG_getMaxLevel(prec->localamg);
115                 options->coarse_level_sparsity=Paso_Preconditioner_LocalAMG_getCoarseLevelSparsity(prec->localamg);
116                 options->num_coarse_unknowns=Paso_Preconditioner_LocalAMG_getNumCoarseUnknwons(prec->localamg);
117              }
118            }            }
119            prec->type=PASO_AMG;            prec->type=PASO_AMG;
120            Esys_MPIInfo_noError(A->mpi_info);            Esys_MPIInfo_noError(A->mpi_info);
# Line 107  Paso_Preconditioner* Paso_Preconditioner Line 122  Paso_Preconditioner* Paso_Preconditioner
122                        
123         /***************************************************************************************/           /***************************************************************************************/  
124             case PASO_ILU0:             case PASO_ILU0:
125            if (options->verbose) printf("Paso: ILU preconditioner is used.\n");            if (options->verbose) printf("Paso_Preconditioner: ILU preconditioner is used.\n");
126                prec->ilu=Paso_Solver_getILU(A->mainBlock,options->verbose);                prec->ilu=Paso_Solver_getILU(A->mainBlock,options->verbose);
127                prec->type=PASO_ILU0;                prec->type=PASO_ILU0;
128            Esys_MPIInfo_noError(A->mpi_info);            Esys_MPIInfo_noError(A->mpi_info);
129                break;                break;
130             case PASO_RILU:             case PASO_RILU:
131            if (options->verbose) printf("Paso: RILU preconditioner is used.\n");            if (options->verbose) printf("Paso_Preconditioner: RILU preconditioner is used.\n");
132                prec->rilu=Paso_Solver_getRILU(A->mainBlock,options->verbose);                prec->rilu=Paso_Solver_getRILU(A->mainBlock,options->verbose);
133            Esys_MPIInfo_noError(A->mpi_info);            Esys_MPIInfo_noError(A->mpi_info);
134                prec->type=PASO_RILU;                prec->type=PASO_RILU;

Legend:
Removed from v.3312  
changed lines
  Added in v.3402

  ViewVC Help
Powered by ViewVC 1.1.26