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

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

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

revision 3458 by gross, Mon Jan 31 07:06:42 2011 UTC revision 3482 by gross, Wed Mar 23 04:06:52 2011 UTC
# Line 288  void Paso_Coupler_copyAll(const Paso_Cou Line 288  void Paso_Coupler_copyAll(const Paso_Cou
288    }    }
289  }  }
290    
291  /* aadds a local vector x * a to the vector y including overlap :*/  /*  */
292  void Paso_Coupler_add(const dim_t n, double* x, const double a, const double* y, Paso_Coupler *coupler)  void Paso_Coupler_fillOverlap(const dim_t n, double* x, Paso_Coupler *coupler)
293  {  {
294     double *remote_values = NULL;     double *remote_values = NULL;
295     const dim_t overlap_n = Paso_Coupler_getNumOverlapValues(coupler) ;     const dim_t overlap_n = Paso_Coupler_getNumOverlapValues(coupler) ;
296     const dim_t my_n= n - overlap_n;     const dim_t my_n= n - overlap_n;
297       const dim_t block_size = coupler->block_size;
298       const dim_t offset = block_size * my_n;
299     dim_t i;     dim_t i;
300        
301     if (ABS(a) > 0 ) {      Paso_Coupler_startCollect(coupler, x);
302        Paso_Coupler_startCollect(coupler, x);      Paso_Coupler_finishCollect(coupler);
303        remote_values=coupler->recv_buffer;
304                
305        if ( a == 1.) {      #pragma omp parallel for private(i)
306       #pragma omp parallel for private(i)      for (i=0;i<overlap_n * block_size; ++i) {
307       for (i=0; i<my_n; i++) {           x[offset+i]=remote_values[i];
308          x[i]+=y[i];      }
      }  
       } else {  
      #pragma omp parallel for private(i)  
      for (i=0; i<my_n; i++) {  
         x[i]+=a*y[i];  
      }  
       }  
         
       Paso_Coupler_finishCollect(coupler);  
       remote_values=coupler->recv_buffer;  
         
       if ( a == 1.) {  
      #pragma omp parallel for private(i)  
      for (i=0;i<overlap_n; ++i) {  
         x[my_n+i]+=remote_values[i];  
      }  
       } else {  
      #pragma omp parallel for private(i)  
      for (i=0;i<overlap_n; ++i) {  
         x[my_n+i]+=a*remote_values[i];  
      }  
       }  
    }  
309  }  }
310    
311  /* adjusts max values across shared values x */  /* adjusts max values across shared values x */

Legend:
Removed from v.3458  
changed lines
  Added in v.3482

  ViewVC Help
Powered by ViewVC 1.1.26