/[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 750 by elspeth, Wed Mar 22 02:46:56 2006 UTC revision 751 by bcumming, Mon Jun 26 01:46:34 2006 UTC
# Line 83  void Finley_Util_AddScatter(dim_t len,in Line 83  void Finley_Util_AddScatter(dim_t len,in
83     }     }
84  }  }
85    
86    #ifdef PASO_MPI
87    /* same as AddScatter(), but checks that value index[] is below an upper bound upperBound before  
88       addition. This is used to ensure that only the influence of local DOF is added */
89    /*        out(1:numData,index[p])+=in(1:numData,p)
90            where p = {k=1...len , index[k]<upperBound}*/
91    void Finley_Util_AddScatter_upperBound(dim_t len,index_t* index,dim_t numData,double* in,double * out, index_t upperBound){
92       dim_t i,s;
93       for (s=0;s<len;s++) {
94           for(i=0;i<numData;i++) {
95              //#pragma omp atomic
96              if( index[s]<upperBound )
97                out[INDEX2(i,index[s],numData)]+=in[INDEX2(i,s,numData)];
98           }
99       }
100    }  
101    
102    
103    #endif
104    
105  /*    multiplies two matrices */  /*    multiplies two matrices */
106    
107  /*          A(1:A1,1:A2)=B(1:A1,1:B2)*C(1:B2,1:A2) */  /*          A(1:A1,1:A2)=B(1:A1,1:B2)*C(1:B2,1:A2) */
# Line 475  void Finley_copyDouble(dim_t n,double* s Line 494  void Finley_copyDouble(dim_t n,double* s
494    for (i=0;i<n;i++) target[i]=source[i];    for (i=0;i<n;i++) target[i]=source[i];
495  }  }
496    
497    #ifdef PASO_MPI
498    void Finley_printDoubleArray( FILE *fid, dim_t n, double *array, char *name  )
499    {
500      index_t i;
501      
502      if( name )
503        fprintf( fid, "%s [ ", name );
504      else
505        fprintf( fid, "[ " );  
506      for( i=0; i<(n<30 ? n : 30); i++ )
507        fprintf( fid, "%g ", array[i] );
508      if( n>=30 )
509        fprintf( fid, "... " );
510      fprintf( fid, "]\n" );
511    }
512    void Finley_printIntArray( FILE *fid, dim_t n, int *array, char *name  )
513    {
514      index_t i;
515      
516      if( name )
517        fprintf( fid, "%s [ ", name );
518      else
519        fprintf( fid, "[ " );  
520      for( i=0; i<(n<30 ? n : 30); i++ )
521        fprintf( fid, "%d ", array[i] );
522      if( n>=30 )
523        fprintf( fid, "... " );
524      fprintf( fid, "]\n" );
525    }
526    void Finley_printMaskArray( FILE *fid, dim_t n, int *array, char *name  )
527    {
528      index_t i;
529      
530      if( name )
531        fprintf( fid, "%s [ ", name );
532      else
533        fprintf( fid, "[ " );  
534      for( i=0; i<(n<30 ? n : 30); i++ )
535        if( array[i]!=-1 )
536          fprintf( fid, "%d ", array[i] );
537        else
538          fprintf( fid, "* " );
539      if( n>=30 )
540        fprintf( fid, "... " );
541      fprintf( fid, "]\n" );
542    }
543    #endif
544    
545  /*  /*
546   * Revision 1.8  2005/08/12 01:45:43  jgs   * Revision 1.8  2005/08/12 01:45:43  jgs
  * erge of development branch dev-02 back to main trunk on 2005-08-12  
547   *   *
548   * Revision 1.7.2.2  2005/09/07 06:26:22  gross   * Revision 1.7.2.2  2005/09/07 06:26:22  gross
549   * the solver from finley are put into the standalone package paso now   * the solver from finley are put into the standalone package paso now

Legend:
Removed from v.750  
changed lines
  Added in v.751

  ViewVC Help
Powered by ViewVC 1.1.26