/[MITgcm]/MITgcm/verification/testreport
ViewVC logotype

Diff of /MITgcm/verification/testreport

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

revision 1.21 by edhill, Thu Nov 27 16:15:39 2003 UTC revision 1.23 by edhill, Sat Nov 29 01:45:25 2003 UTC
# Line 70  build_mpack() Line 70  build_mpack()
70      echo "OK"      echo "OK"
71  }  }
72    
 compare_lines()  
 {  
     # use codelet to compare lines  
     if [ $verbose -gt 1 ]; then  
         cat tmp3.txt 1>&2  
     fi  
     return `./a.out < tmp3.txt`  
 }  
   
73  testoutput_for_prop()  testoutput_for_prop()
74  {  {
75      # testoutput_for_prop dir s1 label subdir      # testoutput_for_prop dir s1 label subdir
# Line 120  testoutput_for_prop() Line 111  testoutput_for_prop()
111      if [ $debug -gt 0 ]; then      if [ $debug -gt 0 ]; then
112          echo testoutput_for_prop: compare_lines 1>&2          echo testoutput_for_prop: compare_lines 1>&2
113      fi      fi
114      compare_lines      if [ $verbose -gt 1 ]; then
115      digits_of_similarity=$?          cat tmp3.txt 1>&2
116        fi
117        echo "-1" >> tmp3.txt
118        # On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number
119        cat tmp3.txt | sed -e 's|:||g' > tmp4.txt
120        digits_of_similarity=`./tmp_cmpnum < tmp4.txt`
121      if [ $digits_of_similarity -eq 99 ]; then      if [ $digits_of_similarity -eq 99 ]; then
122          if [ $verbose -gt 0 ]; then          if [ $verbose -gt 0 ]; then
123              echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2              echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2
# Line 132  testoutput_for_prop() Line 128  testoutput_for_prop()
128              echo There were $digits_of_similarity decimal places of similarity for \"$2\" 1>&2              echo There were $digits_of_similarity decimal places of similarity for \"$2\" 1>&2
129          fi          fi
130      fi      fi
131      rm tmp1.txt tmp2.txt tmp3.txt      rm -f tmp1.txt tmp2.txt tmp3.txt tmp4.txt
132            
133      return $digits_of_similarity      return $digits_of_similarity
134  }  }
# Line 338  createcodelet() Line 334  createcodelet()
334      # create codelet for comparing model output      # create codelet for comparing model output
335    
336      echo -n "creating the comparison code...  "      echo -n "creating the comparison code...  "
337      cat > tmp_cmpnum.f <<EOFA      cat > tmp_cmpnum.c <<EOF
338        program cmpnum  #include <stdio.h>
339        implicit none  #include <math.h>
340        real*8 a,b,diff  int main( int argc, char** argv )  {
341        integer linnum,best    int linnum,best;
342        best=-16    double a,b,diff;
343    99  read(*,*,end=70,err=60) linnum,a,b    best = -16;
344        diff=0.5*(abs(a)+abs(b))    while( 1 )  {
345  c     print *,a,b,diff,abs(a-b)/diff      scanf("%d", &linnum);
346        if (diff.gt.1.e-12) then      if (linnum == -1)  break;
347          diff=abs(a-b)/diff      scanf("%lf", &a);  scanf("%lf", &b);
348          if (diff.gt.0.) then      diff = 0.5*(fabs(a)+fabs(b));
349  c         print *,int(log10(diff)),diff      if (diff > 1.e-12) {
350            linnum=int(log10(diff))        diff=fabs(a-b)/diff;
351            best=max(best,linnum)        if (diff > 0.0) {
352          endif          linnum = (int)log10(diff);
353        else          best = (best > linnum) ? best : linnum;
354          if (best.eq.-16.and.diff.ne.0.) best=-22        }
355        endif        else {
356        goto 99          if (best == -16 && diff != 0)  best = -22;
357    60  stop 'cmpnum: An error occured reading a,b'        }
358    70  print *,-best      }
359        end    }
360  EOFA    printf("%d\n", -best);
361      return 0;
362    }
363    EOF
364        cc -o tmp_cmpnum tmp_cmpnum.c -lm
365    
366      f77 -o a.out tmp_cmpnum.f      if [ -x ./tmp_cmpnum ]; then
     if [ -x ./a.out ]; then  
367          echo "OK"          echo "OK"
368          return 0          return 0
369      else      else
# Line 766  else Line 765  else
765      fi      fi
766  fi  fi
767    
768  rm tmp_cmpnum.f a.out  # rm -f tmp_cmpnum.f a.out
769    rm -f tmp_cmpnum.c tmp_cmpnum
770    
771  if test "x$CLEANUP" != xt ; then  if test "x$CLEANUP" != xt ; then
772      cat $SUMMARY      cat $SUMMARY

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.23

  ViewVC Help
Powered by ViewVC 1.1.22