/[escript]/trunk/finley/src/Util.c
ViewVC logotype

Diff of /trunk/finley/src/Util.c

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

revision 797 by bcumming, Tue Jul 18 00:47:47 2006 UTC revision 798 by gross, Fri Aug 4 01:05:36 2006 UTC
# Line 72  void Finley_Util_Gather_int(dim_t len,in Line 72  void Finley_Util_Gather_int(dim_t len,in
72    
73  /*   adds a vector in into out using and index. */  /*   adds a vector in into out using and index. */
74    
75  /*        out(1:numData,index(1:len))+=in(1:numData,1:len) */  /*        out(1:numData,index[p])+=in(1:numData,p) where p = {k=1...len , index[k]<upperBound}*/
76    
 void Finley_Util_AddScatter(dim_t len,index_t* index,dim_t numData,double* in,double * out){  
    dim_t i,s;  
    for (s=0;s<len;s++) {  
        for(i=0;i<numData;i++) {  
           #pragma omp atomic  
           out[INDEX2(i,index[s],numData)]+=in[INDEX2(i,s,numData)];  
        }  
    }  
 }  
77    
78  #ifdef PASO_MPI  void Finley_Util_AddScatter(dim_t len,index_t* index,dim_t numData,double* in,double * out, index_t upperBound){
 /* same as AddScatter(), but checks that value index[] is below an upper bound upperBound before    
    addition. This is used to ensure that only the influence of local DOF is added */  
 /*        out(1:numData,index[p])+=in(1:numData,p)  
         where p = {k=1...len , index[k]<upperBound}*/  
 void Finley_Util_AddScatter_upperBound(dim_t len,index_t* index,dim_t numData,double* in,double * out, index_t upperBound){  
79     dim_t i,s;     dim_t i,s;
80     for (s=0;s<len;s++) {     for (s=0;s<len;s++) {
81         for(i=0;i<numData;i++) {         for(i=0;i<numData;i++) {
82            //#pragma omp atomic            #pragma omp atomic
83            if( index[s]<upperBound )            if( index[s]<upperBound )
84              out[INDEX2(i,index[s],numData)]+=in[INDEX2(i,s,numData)];              out[INDEX2(i,index[s],numData)]+=in[INDEX2(i,s,numData)];
85         }         }
86     }     }
87  }    }
   
   
 #endif  
88    
89  /*    multiplies two matrices */  /*    multiplies two matrices */
90    

Legend:
Removed from v.797  
changed lines
  Added in v.798

  ViewVC Help
Powered by ViewVC 1.1.26