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

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

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

revision 3093 by artak, Fri Jun 18 04:45:14 2010 UTC revision 3094 by gross, Fri Aug 13 08:38:06 2010 UTC
# Line 55  void Paso_Solver_AMG_free(Paso_Solver_AM Line 55  void Paso_Solver_AMG_free(Paso_Solver_AM
55          if(in->Smoother->ID==PASO_JACOBI)          if(in->Smoother->ID==PASO_JACOBI)
56              Paso_Solver_Jacobi_free(in->Smoother->Jacobi);              Paso_Solver_Jacobi_free(in->Smoother->Jacobi);
57          else if (in->Smoother->ID==PASO_GS)              else if (in->Smoother->ID==PASO_GS)    
58              Paso_Solver_GS_free(in->Smoother->GS);              Paso_Solver_LocalGS_free(in->Smoother->GS);
59          MEMFREE(in->Smoother);          MEMFREE(in->Smoother);
60                            
61          Paso_SparseMatrix_free(in->A_FC);          Paso_SparseMatrix_free(in->A_FC);
# Line 219  Paso_Solver_AMG* Paso_Solver_getAMG(Paso Line 219  Paso_Solver_AMG* Paso_Solver_getAMG(Paso
219                  */                  */
220              #else              #else
221                if (options->smoother == PASO_JACOBI)                if (options->smoother == PASO_JACOBI)
222                  out->Smoother->Jacobi=Paso_Solver_getJacobi(A_p);                  out->Smoother->Jacobi=Paso_Solver_getLocalJacobi(A_p);
223                else if (options->smoother == PASO_GS)                else if (options->smoother == PASO_GS)
224                  out->Smoother->GS=Paso_Solver_getGS(A_p,verbose);           out->Smoother->GS=Paso_Solver_getGS(A_p,verbose);
225              #endif              #endif
226           #endif           #endif
227                    
# Line 229  Paso_Solver_AMG* Paso_Solver_getAMG(Paso Line 229  Paso_Solver_AMG* Paso_Solver_getAMG(Paso
229           out->coarsest_level=FALSE;           out->coarsest_level=FALSE;
230                    
231          if (options->smoother == PASO_JACOBI)          if (options->smoother == PASO_JACOBI)
232                  out->Smoother->Jacobi=Paso_Solver_getJacobi(A_p);         out->Smoother->Jacobi=Paso_Solver_getLocalJacobi(A_p);
233          else if (options->smoother == PASO_GS)          else if (options->smoother == PASO_GS)
234                  out->Smoother->GS=Paso_Solver_getGS(A_p,verbose);                  out->Smoother->GS=Paso_Solver_getLocalGS(A_p,1,verbose);
235    
236           /* identify independend set of rows/columns */           /* identify independend set of rows/columns */
237           #pragma omp parallel for private(i) schedule(static)           #pragma omp parallel for private(i) schedule(static)
# Line 526  void Paso_Solver_solveAMG(Paso_Solver_AM Line 526  void Paso_Solver_solveAMG(Paso_Solver_AM
526    
527        if (amg->n_F==0 || amg->n_F==amg->n) {        if (amg->n_F==0 || amg->n_F==amg->n) {
528          if(amg->Smoother->ID==PASO_JACOBI)          if(amg->Smoother->ID==PASO_JACOBI)
529              Paso_Solver_solveJacobi(amg->Smoother->Jacobi,x,b);         Paso_Solver_solveLocalJacobi(amg->A, amg->Smoother->Jacobi,x,b);
530          else if (amg->Smoother->ID==PASO_GS)              else if (amg->Smoother->ID==PASO_GS)    
531              Paso_Solver_solveGS(amg->Smoother->GS,x,b);         Paso_Solver_solveLocalGS(amg->A, amg->Smoother->GS,x,b);
532        }        }
533         else {         else {
534         #ifdef MKL         #ifdef MKL
# Line 540  void Paso_Solver_solveAMG(Paso_Solver_AM Line 540  void Paso_Solver_solveAMG(Paso_Solver_AM
540               amg->solver=(void*) ptr;               amg->solver=(void*) ptr;
541            #else                  #else      
542             if(amg->Smoother->ID==PASO_JACOBI)             if(amg->Smoother->ID==PASO_JACOBI)
543               Paso_Solver_solveJacobi(amg->Smoother->Jacobi,x,b);               Paso_Solver_solveLocalJacobi(amg->Smoother->Jacobi,x,b);
544            else if (amg->Smoother->ID==PASO_GS)                else if (amg->Smoother->ID==PASO_GS)    
545              Paso_Solver_solveGS(amg->Smoother->GS,x,b);              Paso_Solver_solveLocalGS(amg->Smoother->GS,x,b);
546           #endif           #endif
547         #endif         #endif
548         }         }
# Line 554  void Paso_Solver_solveAMG(Paso_Solver_AM Line 554  void Paso_Solver_solveAMG(Paso_Solver_AM
554          /* presmoothing */          /* presmoothing */
555           time0=Paso_timer();           time0=Paso_timer();
556           if(amg->Smoother->ID==PASO_JACOBI)           if(amg->Smoother->ID==PASO_JACOBI)
557              Paso_Solver_solveJacobi(amg->Smoother->Jacobi,x,b);              Paso_Solver_solveLocalJacobi(amg->A, amg->Smoother->Jacobi,x,b);
558          else if (amg->Smoother->ID==PASO_GS)              else if (amg->Smoother->ID==PASO_GS)    
559              Paso_Solver_solveGS(amg->Smoother->GS,x,b);         Paso_Solver_solveLocalGS(amg->A, amg->Smoother->GS,x,b);
560                    
561          /***********/          /***********/
562          if (pre_sweeps>1) {          if (pre_sweeps>1) {
# Line 582  void Paso_Solver_solveAMG(Paso_Solver_AM Line 582  void Paso_Solver_solveAMG(Paso_Solver_AM
582             /* Go round again*/             /* Go round again*/
583                        
584             if(amg->Smoother->ID==PASO_JACOBI)             if(amg->Smoother->ID==PASO_JACOBI)
585              Paso_Solver_solveJacobi(amg->Smoother->Jacobi,x,r);            Paso_Solver_solveLocalJacobi(amg->A, amg->Smoother->Jacobi,x,r);
586             else if (amg->Smoother->ID==PASO_GS)                 else if (amg->Smoother->ID==PASO_GS)    
587              Paso_Solver_solveGS(amg->Smoother->GS,x,r);            Paso_Solver_solveLocalGS(amg->A, amg->Smoother->GS,x,r);
588                        
589             pre_sweeps-=1;             pre_sweeps-=1;
590          }          }
# Line 640  void Paso_Solver_solveAMG(Paso_Solver_AM Line 640  void Paso_Solver_solveAMG(Paso_Solver_AM
640        /*r=b-Ax */        /*r=b-Ax */
641        Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(-1.,amg->A,x,1.,r);        Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(-1.,amg->A,x,1.,r);
642        if(amg->Smoother->ID==PASO_JACOBI)        if(amg->Smoother->ID==PASO_JACOBI)
643              Paso_Solver_solveJacobi(amg->Smoother->Jacobi,x0,r);       Paso_Solver_solveLocalJacobi(amg->A, amg->Smoother->Jacobi,x0,r);
644        else if (amg->Smoother->ID==PASO_GS)            else if (amg->Smoother->ID==PASO_GS)    
645              Paso_Solver_solveGS(amg->Smoother->GS,x0,r);       Paso_Solver_solveLocalGS(amg->A, amg->Smoother->GS,x0,r);
646                
647             #pragma omp parallel for private(i,j) schedule(static)             #pragma omp parallel for private(i,j) schedule(static)
648             for (i=0;i<amg->n;++i) {             for (i=0;i<amg->n;++i) {
# Line 664  void Paso_Solver_solveAMG(Paso_Solver_AM Line 664  void Paso_Solver_solveAMG(Paso_Solver_AM
664             Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(-1.,amg->A,x,1.,r);             Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(-1.,amg->A,x,1.,r);
665                        
666             if(amg->Smoother->ID==PASO_JACOBI)             if(amg->Smoother->ID==PASO_JACOBI)
667                Paso_Solver_solveJacobi(amg->Smoother->Jacobi,x0,r);            Paso_Solver_solveLocalJacobi(amg->A, amg->Smoother->Jacobi,x0,r);
668             else if (amg->Smoother->ID==PASO_GS)                 else if (amg->Smoother->ID==PASO_GS)    
669                Paso_Solver_solveGS(amg->Smoother->GS,x0,r);            Paso_Solver_solveLocalGS(amg->A, amg->Smoother->GS,x0,r);
670                                
671              #pragma omp parallel for private(i,j) schedule(static)              #pragma omp parallel for private(i,j) schedule(static)
672             for (i=0;i<amg->n;++i) {             for (i=0;i<amg->n;++i) {

Legend:
Removed from v.3093  
changed lines
  Added in v.3094

  ViewVC Help
Powered by ViewVC 1.1.26