/[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 1959 by artak, Fri Oct 31 03:22:34 2008 UTC revision 1960 by artak, Tue Nov 4 05:50:41 2008 UTC
# Line 296  Paso_Solver_AMG* Paso_Solver_getAMG(Paso Line 296  Paso_Solver_AMG* Paso_Solver_getAMG(Paso
296    if (Paso_noError()) {    if (Paso_noError()) {
297        if (verbose) {        if (verbose) {
298           printf("AMG: %d unknowns eliminated. %d left.\n",out->n_F,n-out->n_F);           printf("AMG: %d unknowns eliminated. %d left.\n",out->n_F,n-out->n_F);
299           if (out->n_C>10) {           if (level<2) {
300              printf("timing: AMG: MIS/reordering/elemination : %e/%e/%e\n",time2,time0,time1);              printf("timing: AMG: MIS/reordering/elemination : %e/%e/%e\n",time2,time0,time1);
301           } else {           } else {
302              printf("timing: AMG: MIS: %e\n",time2);              printf("timing: AMG: MIS: %e\n",time2);
# Line 334  Paso_Solver_AMG* Paso_Solver_getAMG(Paso Line 334  Paso_Solver_AMG* Paso_Solver_getAMG(Paso
334  */  */
335    
336  void Paso_Solver_solveAMG(Paso_Solver_AMG * amg, double * x, double * b) {  void Paso_Solver_solveAMG(Paso_Solver_AMG * amg, double * x, double * b) {
337       dim_t i,k,oldsweeps,j;       dim_t i,oldsweeps;
338       double *r=MEMALLOC(amg->n,double);       double *r=MEMALLOC(amg->n,double);
339       /*Paso_Solver_GS* GS=NULL;*/       /*Paso_Solver_GS* GS=NULL;*/
340       double *bold=MEMALLOC(amg->n,double);       double *bold=MEMALLOC(amg->n,double);
341       double *bnew=MEMALLOC(amg->n,double);       double *bnew=MEMALLOC(amg->n,double);
342       double *x0=MEMALLOC(amg->n,double);       double *x0=MEMALLOC(amg->n,double);
      index_t iPtr;  
343    
344       if (amg->level==2) {       if (amg->level==2) {
345       /*if (amg->n_C<=10) {*/       /*if (amg->n_C<=10) {*/
# Line 349  void Paso_Solver_solveAMG(Paso_Solver_AM Line 348  void Paso_Solver_solveAMG(Paso_Solver_AM
348            
349          /* presmoothing */          /* presmoothing */
350           Paso_Solver_solveGS(amg->GS,x,b);           Paso_Solver_solveGS(amg->GS,x,b);
351           oldsweeps=amg->GS->sweeps;            oldsweeps=amg->GS->sweeps;
352           if (amg->GS->sweeps>1) {           if (amg->GS->sweeps>1) {
353                        
354             #pragma omp parallel for private(i) schedule(static)             #pragma omp parallel for private(i) schedule(static)
# Line 358  void Paso_Solver_solveAMG(Paso_Solver_AM Line 357  void Paso_Solver_solveAMG(Paso_Solver_AM
357             while(amg->GS->sweeps>1) {             while(amg->GS->sweeps>1) {
358                 #pragma omp parallel for private(i) schedule(static)                 #pragma omp parallel for private(i) schedule(static)
359                 for (i=0;i<amg->GS->n;++i) bnew[i]=bold[i]+b[i];                 for (i=0;i<amg->GS->n;++i) bnew[i]=bold[i]+b[i];
                 /* Compute the residual b=b-Ax*/  
360                 Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(DBLE(-1), amg->A, x, DBLE(1), bnew);                 Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(DBLE(-1), amg->A, x, DBLE(1), bnew);
                /* Go round again*/  
361                 Paso_Solver_solveGS(amg->GS,x,bnew);                 Paso_Solver_solveGS(amg->GS,x,bnew);
362                 #pragma omp parallel for private(i) schedule(static)                 #pragma omp parallel for private(i) schedule(static)
363                 for (i=0;i<amg->GS->n;++i) bold[i]=bnew[i];                 for (i=0;i<amg->GS->n;++i) bold[i]=bnew[i];
# Line 368  void Paso_Solver_solveAMG(Paso_Solver_AM Line 365  void Paso_Solver_solveAMG(Paso_Solver_AM
365             }             }
366             }             }
367             amg->GS->sweeps=oldsweeps;             amg->GS->sweeps=oldsweeps;
368              
369          /* end of presmoothing */          /* end of presmoothing */
370                    
371           #pragma omp parallel for private(i) schedule(static)           #pragma omp parallel for private(i) schedule(static)

Legend:
Removed from v.1959  
changed lines
  Added in v.1960

  ViewVC Help
Powered by ViewVC 1.1.26