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

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

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

revision 3835 by gross, Wed Feb 15 23:19:01 2012 UTC revision 3884 by gross, Wed Apr 4 04:55:43 2012 UTC
# Line 101  Paso_Preconditioner_AMG* Paso_Preconditi Line 101  Paso_Preconditioner_AMG* Paso_Preconditi
101    
102    const dim_t n_block=A_p->row_block_size;    const dim_t n_block=A_p->row_block_size;
103    index_t* F_marker=NULL, *counter=NULL, *mask_C=NULL, *rows_in_F;    index_t* F_marker=NULL, *counter=NULL, *mask_C=NULL, *rows_in_F;
104    dim_t i, n_F, n_C, F_flag, *F_set=NULL;    dim_t i, n_F, n_C, F_flag, *F_set=NULL, total_n_C=0, total_n_F=0;
105    double time0=0;    double time0=0;
106    const double theta = options->coarsening_threshold;    const double theta = options->coarsening_threshold;
107    const double tau = options->diagonal_dominance_threshold;    const double tau = options->diagonal_dominance_threshold;
# Line 202  Paso_Preconditioner_AMG* Paso_Preconditi Line 202  Paso_Preconditioner_AMG* Paso_Preconditi
202             count number of unkowns to be eliminated:             count number of unkowns to be eliminated:
203          */          */
204          n_F=Paso_Util_cumsum_maskedTrue(n,counter, F_marker);          n_F=Paso_Util_cumsum_maskedTrue(n,counter, F_marker);
         n_C=n-n_F;  
         if (verbose) printf("Paso_Preconditioner: AMG (non-local) level %d: %d unknowns are flagged for elimination. %d left.\n",level,n_F,n-n_F);  
   
205              /* collect n_F values on all processes, a direct solver should              /* collect n_F values on all processes, a direct solver should
206                  be used if any n_F value is 0 */                  be used if any n_F value is 0 */
207              F_set = TMPMEMALLOC(A_p->mpi_info->size, dim_t);              F_set = TMPMEMALLOC(A_p->mpi_info->size, dim_t);
208          #ifdef ESYS_MPI          #ifdef ESYS_MPI
209              MPI_Allgather(&n_F, 1, MPI_INT, F_set, 1, MPI_INT, A_p->mpi_info->comm);              MPI_Allgather(&n_F, 1, MPI_INT, F_set, 1, MPI_INT, A_p->mpi_info->comm);
210          #endif          #endif
211                total_n_F=0;
212              F_flag = 1;              F_flag = 1;
213              for (i=0; i<A_p->mpi_info->size; i++) {              for (i=0; i<A_p->mpi_info->size; i++) {
214                    total_n_F+=F_set[i];
215                  if (F_set[i] == 0) {                  if (F_set[i] == 0) {
216                    F_flag = 0;                    F_flag = 0;
217                    break;                    break;
218                  }                  }
219              }              }
220              TMPMEMFREE(F_set);              TMPMEMFREE(F_set);
221    
222            n_C=n-n_F;
223                total_n_C=total_n-total_n_F;
224            if (verbose) printf("Paso_Preconditioner: AMG (non-local) level %d: %d unknowns are flagged for elimination. %d left.\n",level,total_n_F,total_n_C);
225    
226                    
227  /*          if ( n_F == 0 ) {  is a nasty case. a direct solver should be used, return NULL */  /*          if ( n_F == 0 ) {  is a nasty case. a direct solver should be used, return NULL */
228              if (F_flag == 0) {              if (F_flag == 0) {
# Line 249  Paso_Preconditioner_AMG* Paso_Preconditi Line 253  Paso_Preconditioner_AMG* Paso_Preconditi
253    
254            out->Smoother = Paso_Preconditioner_Smoother_alloc(A_p, (options->smoother == PASO_JACOBI), 0, verbose);            out->Smoother = Paso_Preconditioner_Smoother_alloc(A_p, (options->smoother == PASO_JACOBI), 0, verbose);
255                
256            if (n_C != 0) {            if (total_n_C != 0) {
257                 /* if nothing has been removed we have a diagonal dominant matrix and we just run a few steps of the smoother */                 /* if nothing has been removed we have a diagonal dominant matrix and we just run a few steps of the smoother */
258        
259              /* allocate helpers :*/              /* allocate helpers :*/
# Line 774  void Paso_Preconditioner_AMG_CIJPCoarsen Line 778  void Paso_Preconditioner_AMG_CIJPCoarsen
778    
779        
780    numUndefined = Paso_Distribution_numPositives(Status, col_dist, 1 );    numUndefined = Paso_Distribution_numPositives(Status, col_dist, 1 );
781    printf(" coarsening loop start: num of undefined rows = %d \n",numUndefined);    /* printf(" coarsening loop start: num of undefined rows = %d \n",numUndefined);  */
782    iter=0;    iter=0;
783    while (numUndefined > 0) {    while (numUndefined > 0) {
784       Paso_Coupler_fillOverlap(n, w, w_coupler);       Paso_Coupler_fillOverlap(n, w, w_coupler);
# Line 902  void Paso_Preconditioner_AMG_CIJPCoarsen Line 906  void Paso_Preconditioner_AMG_CIJPCoarsen
906       }       }
907    
908       iter++;       iter++;
909       printf(" coarsening loop %d: num of undefined rows = %d \n",iter, numUndefined);       /* printf(" coarsening loop %d: num of undefined rows = %d \n",iter, numUndefined); */
910    
911    } /* end of while loop */    } /* end of while loop */
912    

Legend:
Removed from v.3835  
changed lines
  Added in v.3884

  ViewVC Help
Powered by ViewVC 1.1.26