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

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

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

trunk/paso/src/AMG_Prolongation.c revision 3440 by gross, Fri Jan 14 00:04:53 2011 UTC trunk/paso/src/LocalAMG_Prolongation.c revision 3441 by gross, Fri Jan 14 01:09:09 2011 UTC
# Line 47  Line 47 
47  */  */
48    
49    
50  Paso_SparseMatrix* Paso_Preconditioner_AMG_getProlongation(Paso_SparseMatrix* A_p,  Paso_SparseMatrix* Paso_Preconditioner_LocalAMG_getProlongation(Paso_SparseMatrix* A_p,
51                                                             const index_t* offset_S, const dim_t* degree_S, const index_t* S,                                                             const index_t* offset_S, const dim_t* degree_S, const index_t* S,
52                                 const dim_t n_C, const index_t* counter_C, const index_t interpolation_method)                                 const dim_t n_C, const index_t* counter_C, const index_t interpolation_method)
53  {  {
# Line 117  Paso_SparseMatrix* Paso_Preconditioner_A Line 117  Paso_SparseMatrix* Paso_Preconditioner_A
117     if (Esys_noError()) {     if (Esys_noError()) {
118        if ( (interpolation_method == PASO_CLASSIC_INTERPOLATION_WITH_FF_COUPLING) || ( interpolation_method == PASO_CLASSIC_INTERPOLATION) ) {        if ( (interpolation_method == PASO_CLASSIC_INTERPOLATION_WITH_FF_COUPLING) || ( interpolation_method == PASO_CLASSIC_INTERPOLATION) ) {
119          if (n_block == 1) {          if (n_block == 1) {
120          Paso_Preconditioner_AMG_setClassicProlongation(out, A_p, offset_S, degree_S, S, counter_C);          Paso_Preconditioner_LocalAMG_setClassicProlongation(out, A_p, offset_S, degree_S, S, counter_C);
121          } else {          } else {
122          Paso_Preconditioner_AMG_setClassicProlongation_Block(out, A_p, offset_S, degree_S, S, counter_C);          Paso_Preconditioner_LocalAMG_setClassicProlongation_Block(out, A_p, offset_S, degree_S, S, counter_C);
123          }          }
124        } else {        } else {
125          if (n_block == 1) {          if (n_block == 1) {
126              Paso_Preconditioner_AMG_setDirectProlongation(out, A_p, counter_C);              Paso_Preconditioner_LocalAMG_setDirectProlongation(out, A_p, counter_C);
127          } else {          } else {
128          Paso_Preconditioner_AMG_setDirectProlongation_Block(out, A_p, counter_C);          Paso_Preconditioner_LocalAMG_setDirectProlongation_Block(out, A_p, counter_C);
129          }          }
130        }        }
131     }     }
# Line 154  Paso_SparseMatrix* Paso_Preconditioner_A Line 154  Paso_SparseMatrix* Paso_Preconditioner_A
154    
155  */  */
156    
157  void Paso_Preconditioner_AMG_setDirectProlongation(Paso_SparseMatrix* P_p,  void Paso_Preconditioner_LocalAMG_setDirectProlongation(Paso_SparseMatrix* P_p,
158                                 const Paso_SparseMatrix* A_p,                                 const Paso_SparseMatrix* A_p,
159                             const index_t *counter_C) {                             const index_t *counter_C) {
160     dim_t i;     dim_t i;
# Line 236  void Paso_Preconditioner_AMG_setDirectPr Line 236  void Paso_Preconditioner_AMG_setDirectPr
236     }     }
237  }  }
238    
239  void Paso_Preconditioner_AMG_setDirectProlongation_Block(Paso_SparseMatrix* P_p,  void Paso_Preconditioner_LocalAMG_setDirectProlongation_Block(Paso_SparseMatrix* P_p,
240                                   const Paso_SparseMatrix* A_p,                                   const Paso_SparseMatrix* A_p,
241                                   const index_t *counter_C) {                                   const index_t *counter_C) {
242     dim_t i;     dim_t i;
# Line 366  void Paso_Preconditioner_AMG_setDirectPr Line 366  void Paso_Preconditioner_AMG_setDirectPr
366                                
367    
368  */  */
369  void Paso_Preconditioner_AMG_setClassicProlongation(Paso_SparseMatrix* P_p,  void Paso_Preconditioner_LocalAMG_setClassicProlongation(Paso_SparseMatrix* P_p,
370                                 Paso_SparseMatrix* A_p,                                 Paso_SparseMatrix* A_p,
371                                                     const index_t* offset_S, const dim_t* degree_S, const index_t* S,                                                     const index_t* offset_S, const dim_t* degree_S, const index_t* S,
372                             const index_t *counter_C) {                             const index_t *counter_C) {
# Line 409  void Paso_Preconditioner_AMG_setClassicP Line 409  void Paso_Preconditioner_AMG_setClassicP
409                          if  (counter_C[j]>=0)  { /* j is an interpolation point : add A_ij into P */                          if  (counter_C[j]>=0)  { /* j is an interpolation point : add A_ij into P */
410                             const index_t *where_p=(index_t*)bsearch(&counter_C[j], start_p,degree_P_i, sizeof(index_t), Paso_comparIndex);                             const index_t *where_p=(index_t*)bsearch(&counter_C[j], start_p,degree_P_i, sizeof(index_t), Paso_comparIndex);
411                                 if (where_p == NULL)  {                                 if (where_p == NULL)  {
412                                         Esys_setError(SYSTEM_ERROR, "Paso_Preconditioner_AMG_setBoomerProlongation: interpolation point is missing.");                                         Esys_setError(SYSTEM_ERROR, "Paso_Preconditioner_LocalAMG_setBoomerProlongation: interpolation point is missing.");
413                                 } else {                                 } else {
414                              const index_t offset = P_p->pattern->ptr[i]+ (index_t)(where_p-start_p);                              const index_t offset = P_p->pattern->ptr[i]+ (index_t)(where_p-start_p);
415                                  P_p->val[offset]+=A_ij;                                  P_p->val[offset]+=A_ij;
# Line 462  void Paso_Preconditioner_AMG_setClassicP Line 462  void Paso_Preconditioner_AMG_setClassicP
462       }    /* end of parallel region */       }    /* end of parallel region */
463  }  }
464    
465  void Paso_Preconditioner_AMG_setClassicProlongation_Block(Paso_SparseMatrix* P_p,  void Paso_Preconditioner_LocalAMG_setClassicProlongation_Block(Paso_SparseMatrix* P_p,
466                                 Paso_SparseMatrix* A_p,                                 Paso_SparseMatrix* A_p,
467                                                     const index_t* offset_S, const dim_t* degree_S, const index_t* S,                                                     const index_t* offset_S, const dim_t* degree_S, const index_t* S,
468                             const index_t *counter_C) {                             const index_t *counter_C) {
# Line 510  void Paso_Preconditioner_AMG_setClassicP Line 510  void Paso_Preconditioner_AMG_setClassicP
510                          if  (counter_C[j]>=0)  { /* j is an interpolation point : add A_ij into P */                          if  (counter_C[j]>=0)  { /* j is an interpolation point : add A_ij into P */
511                             const index_t *where_p=(index_t*)bsearch(&counter_C[j], start_p,degree_P_i, sizeof(index_t), Paso_comparIndex);                             const index_t *where_p=(index_t*)bsearch(&counter_C[j], start_p,degree_P_i, sizeof(index_t), Paso_comparIndex);
512                                 if (where_p == NULL)  {                                 if (where_p == NULL)  {
513                                         Esys_setError(SYSTEM_ERROR, "Paso_Preconditioner_AMG_setBoomerProlongation: interpolation point is missing.");                                         Esys_setError(SYSTEM_ERROR, "Paso_Preconditioner_LocalAMG_setClassicProlongation: interpolation point is missing.");
514                                 } else {                                 } else {
515                              const index_t offset = P_p->pattern->ptr[i]+ (index_t)(where_p-start_p);                              const index_t offset = P_p->pattern->ptr[i]+ (index_t)(where_p-start_p);
516                                      for (ib=0; ib<row_block; ib++) P_p->val[offset*row_block+ib] +=A_ij[(row_block+1)*ib];                                      for (ib=0; ib<row_block; ib++) P_p->val[offset*row_block+ib] +=A_ij[(row_block+1)*ib];

Legend:
Removed from v.3440  
changed lines
  Added in v.3441

  ViewVC Help
Powered by ViewVC 1.1.26