/[escript]/branches/domexper/dudley/src/Util.c
ViewVC logotype

Diff of /branches/domexper/dudley/src/Util.c

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

revision 751 by bcumming, Mon Jun 26 01:46:34 2006 UTC revision 782 by bcumming, Tue Jul 18 00:47:47 2006 UTC
# Line 23  Line 23 
23    
24  #include "Finley.h"  #include "Finley.h"
25  #include "Util.h"  #include "Util.h"
26    
27  #ifdef _OPENMP  #ifdef _OPENMP
28  #include <omp.h>  #include <omp.h>
29  #endif  #endif
# Line 371  int Finley_Util_ValueAndIndex_compar(con Line 372  int Finley_Util_ValueAndIndex_compar(con
372     e2=(Finley_Util_ValueAndIndex*) arg2;     e2=(Finley_Util_ValueAndIndex*) arg2;
373     if (e1->value < e2->value) return -1;     if (e1->value < e2->value) return -1;
374     if (e1->value > e2->value) return  1;     if (e1->value > e2->value) return  1;
375       if (e1->index < e2->index) return -1;
376       if (e1->index > e2->index) return  1;
377    
378     return 0;     return 0;
379  }  }
380    
381  void Finley_Util_sortValueAndIndex(dim_t n,Finley_Util_ValueAndIndex* array) {  void Finley_Util_sortValueAndIndex(dim_t n,Finley_Util_ValueAndIndex* array) {
382       /* OMP : needs parallelization !*/       /* OMP : needs parallelization !*/
383       qsort(array,n,sizeof(Finley_Util_ValueAndIndex),Finley_Util_ValueAndIndex_compar);       qsort(array,n,sizeof(Finley_Util_ValueAndIndex),Finley_Util_ValueAndIndex_compar);
# Line 503  void Finley_printDoubleArray( FILE *fid, Line 508  void Finley_printDoubleArray( FILE *fid,
508      fprintf( fid, "%s [ ", name );      fprintf( fid, "%s [ ", name );
509    else    else
510      fprintf( fid, "[ " );        fprintf( fid, "[ " );  
511    for( i=0; i<(n<30 ? n : 30); i++ )    for( i=0; i<(n<60 ? n : 60); i++ )
512      fprintf( fid, "%g ", array[i] );      fprintf( fid, "%g ", array[i] );
513    if( n>=30 )    if( n>=30 )
514      fprintf( fid, "... " );      fprintf( fid, "... " );
# Line 517  void Finley_printIntArray( FILE *fid, di Line 522  void Finley_printIntArray( FILE *fid, di
522      fprintf( fid, "%s [ ", name );      fprintf( fid, "%s [ ", name );
523    else    else
524      fprintf( fid, "[ " );        fprintf( fid, "[ " );  
525    for( i=0; i<(n<30 ? n : 30); i++ )    for( i=0; i<(n<60 ? n : 60); i++ )
526      fprintf( fid, "%d ", array[i] );      fprintf( fid, "%d ", array[i] );
527    if( n>=30 )    if( n>=30 )
528      fprintf( fid, "... " );      fprintf( fid, "... " );
# Line 531  void Finley_printMaskArray( FILE *fid, d Line 536  void Finley_printMaskArray( FILE *fid, d
536      fprintf( fid, "%s [ ", name );      fprintf( fid, "%s [ ", name );
537    else    else
538      fprintf( fid, "[ " );        fprintf( fid, "[ " );  
539    for( i=0; i<(n<30 ? n : 30); i++ )    for( i=0; i<(n<60 ? n : 60); i++ )
540      if( array[i]!=-1 )      if( array[i]!=-1 )
541        fprintf( fid, "%d ", array[i] );        fprintf( fid, "%3d ", array[i] );
542      else      else
543        fprintf( fid, "* " );        fprintf( fid, "  * " );
544    if( n>=30 )    if( n>=30 )
545      fprintf( fid, "... " );      fprintf( fid, "... " );
546    fprintf( fid, "]\n" );    fprintf( fid, "]\n" );

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

  ViewVC Help
Powered by ViewVC 1.1.26