/[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 2441 by artak, Tue May 26 04:34:21 2009 UTC revision 2442 by artak, Fri May 29 00:39:44 2009 UTC
# Line 82  Paso_Solver_AMG* Paso_Solver_getAMG(Paso Line 82  Paso_Solver_AMG* Paso_Solver_getAMG(Paso
82    Paso_SparseMatrix * schur=NULL;    Paso_SparseMatrix * schur=NULL;
83    Paso_SparseMatrix * schur_withFillIn=NULL;    Paso_SparseMatrix * schur_withFillIn=NULL;
84    double S=0;    double S=0;
85        
86    /*Make sure we have block sizes 1*/    /*Make sure we have block sizes 1*/
87    A_p->pattern->input_block_size=A_p->col_block_size;    A_p->pattern->input_block_size=A_p->col_block_size;
88    A_p->pattern->output_block_size=A_p->row_block_size;    A_p->pattern->output_block_size=A_p->row_block_size;
# Line 111  Paso_Solver_AMG* Paso_Solver_getAMG(Paso Line 111  Paso_Solver_AMG* Paso_Solver_getAMG(Paso
111    out->GS=Paso_Solver_getJacobi(A_p);    out->GS=Paso_Solver_getJacobi(A_p);
112    /*out->GS->sweeps=2;*/    /*out->GS->sweeps=2;*/
113    out->level=level;    out->level=level;
114      
115    if ( !(Paso_checkPtr(mis_marker) || Paso_checkPtr(out) || Paso_checkPtr(counter) ) ) {    if ( !(Paso_checkPtr(mis_marker) || Paso_checkPtr(out) || Paso_checkPtr(counter) || level==0 ) ) {
116       /* identify independend set of rows/columns */       /* identify independend set of rows/columns */
117       #pragma omp parallel for private(i) schedule(static)       #pragma omp parallel for private(i) schedule(static)
118       for (i=0;i<n;++i) mis_marker[i]=-1;       for (i=0;i<n;++i) mis_marker[i]=-1;
# Line 152  Paso_Solver_AMG* Paso_Solver_getAMG(Paso Line 152  Paso_Solver_AMG* Paso_Solver_getAMG(Paso
152                   if (mis_marker[j])                   if (mis_marker[j])
153                       S+=A_p->val[iPtr];                       S+=A_p->val[iPtr];
154                  }                  }
155                     out->inv_A_FF[i]=1./S;                  out->inv_A_FF[i]=1./S;
156                }                }
157    
158             if( Paso_noError()) {             if( Paso_noError()) {
# Line 198  Paso_Solver_AMG* Paso_Solver_getAMG(Paso Line 198  Paso_Solver_AMG* Paso_Solver_getAMG(Paso
198                                for (iPtr=schur_withFillIn->pattern->ptr[i];iPtr<schur_withFillIn->pattern->ptr[i + 1]; ++iPtr) {                                for (iPtr=schur_withFillIn->pattern->ptr[i];iPtr<schur_withFillIn->pattern->ptr[i + 1]; ++iPtr) {
199                                  j=schur_withFillIn->pattern->index[iPtr];                                  j=schur_withFillIn->pattern->index[iPtr];
200                                  iPtr_s=schur->pattern->ptr[i];                                  iPtr_s=schur->pattern->ptr[i];
201                                  schur_withFillIn->val[iPtr]=0.;                                  /*schur_withFillIn->val[iPtr]=0.;*/
202                                  index=&(schur->pattern->index[iPtr_s]);                                  index=&(schur->pattern->index[iPtr_s]);
203                                  where_p=(index_t*)bsearch(&j,                                  where_p=(index_t*)bsearch(&j,
204                                          index,                                          index,
# Line 251  Paso_Solver_AMG* Paso_Solver_getAMG(Paso Line 251  Paso_Solver_AMG* Paso_Solver_getAMG(Paso
251    TMPMEMFREE(mis_marker);    TMPMEMFREE(mis_marker);
252    TMPMEMFREE(counter);    TMPMEMFREE(counter);
253    if (Paso_noError()) {    if (Paso_noError()) {
254        if (verbose) {        if (verbose && level>0) {
255           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,out->n_C);
256           /*if (level>0 && out->n_F>500) {*/           /*if (level>0 && out->n_F>500) {*/
257          /* if (out->n_F<500) {*/          /* if (out->n_F<500) {*/
258          /*   printf("timing: AMG: MIS/reordering/elemination : %e/%e\n",time0,time1);          /*   printf("timing: AMG: MIS/reordering/elemination : %e/%e\n",time0,time1);
# Line 375  void Paso_Solver_solveAMG(Paso_Solver_AM Line 375  void Paso_Solver_solveAMG(Paso_Solver_AM
375       #pragma omp parallel for private(i) schedule(static)       #pragma omp parallel for private(i) schedule(static)
376       for (i=0;i<amg->n;++i) r[i]=b[i];       for (i=0;i<amg->n;++i) r[i]=b[i];
377            
378       /*r=b-Ax*/       /*r=b-Ax */
379       Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(-1.,amg->A,x,1.,r);       Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(-1.,amg->A,x,1.,r);
380       Paso_Solver_solveJacobi(amg->GS,x0,r);       Paso_Solver_solveJacobi(amg->GS,x0,r);
381            
# Line 387  void Paso_Solver_solveAMG(Paso_Solver_AM Line 387  void Paso_Solver_solveAMG(Paso_Solver_AM
387       for (i=0;i<amg->n;++i) r[i]=b[i];       for (i=0;i<amg->n;++i) r[i]=b[i];
388    
389       Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(-1.,amg->A,x,1.,r);       Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(-1.,amg->A,x,1.,r);
390       Paso_Solver_solveGS(amg->GS,x0,r);       Paso_Solver_solveJacobi(amg->GS,x0,r);
391            
392       #pragma omp parallel for private(i) schedule(static)       #pragma omp parallel for private(i) schedule(static)
393       for (i=0;i<amg->n;++i) {       for (i=0;i<amg->n;++i) {
394        x[i]+=x0[i];        x[i]+=x0[i];
395       }       }*/
396       */      
397       /*end of postsmoothing*/       /*end of postsmoothing*/
398            
399       }       }

Legend:
Removed from v.2441  
changed lines
  Added in v.2442

  ViewVC Help
Powered by ViewVC 1.1.26