120 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
121 |
echo testoutput_for_prop: compare_lines 1>&2 |
echo testoutput_for_prop: compare_lines 1>&2 |
122 |
fi |
fi |
123 |
compare_lines |
if [ $verbose -gt 1 ]; then |
124 |
digits_of_similarity=$? |
cat tmp3.txt 1>&2 |
125 |
|
fi |
126 |
|
echo "-1" >> tmp3.txt |
127 |
|
digits_of_similarity=`./tmp_cmpnum < tmp3.txt` |
128 |
if [ $digits_of_similarity -eq 99 ]; then |
if [ $digits_of_similarity -eq 99 ]; then |
129 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
130 |
echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2 |
echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2 |
341 |
# create codelet for comparing model output |
# create codelet for comparing model output |
342 |
|
|
343 |
echo -n "creating the comparison code... " |
echo -n "creating the comparison code... " |
344 |
cat > tmp_cmpnum.f <<EOFA |
cat > tmp_cmpnum.c <<EOF |
345 |
program cmpnum |
#include <stdio.h> |
346 |
implicit none |
#include <math.h> |
347 |
real*8 a,b,diff |
int main( int argc, char** argv ) { |
348 |
integer linnum,best |
int linnum,best; |
349 |
best=-16 |
double a,b,diff; |
350 |
99 read(*,*,end=70,err=60) linnum,a,b |
best = -16; |
351 |
diff=0.5*(abs(a)+abs(b)) |
while( 1 ) { |
352 |
c print *,a,b,diff,abs(a-b)/diff |
scanf("%d", &linnum); |
353 |
if (diff.gt.1.e-12) then |
if (linnum == -1) break; |
354 |
diff=abs(a-b)/diff |
scanf("%lf", &a); scanf("%lf", &b); |
355 |
if (diff.gt.0.) then |
diff = 0.5*(fabs(a)+fabs(b)); |
356 |
c print *,int(log10(diff)),diff |
if (diff > 1.e-12) { |
357 |
linnum=int(log10(diff)) |
diff=fabs(a-b)/diff; |
358 |
best=max(best,linnum) |
if (diff > 0.0) { |
359 |
endif |
linnum = (int)log10(diff); |
360 |
else |
best = (best > linnum) ? best : linnum; |
361 |
if (best.eq.-16.and.diff.ne.0.) best=-22 |
} |
362 |
endif |
else { |
363 |
goto 99 |
if (best == -16 && diff != 0) best = -22; |
364 |
60 stop 'cmpnum: An error occured reading a,b' |
} |
365 |
70 print *,-best |
} |
366 |
end |
} |
367 |
EOFA |
printf("%d\n", -best); |
368 |
|
return 0; |
369 |
|
} |
370 |
|
EOF |
371 |
|
cc -o tmp_cmpnum tmp_cmpnum.c -lm |
372 |
|
|
373 |
f77 -o a.out tmp_cmpnum.f |
if [ -x ./tmp_cmpnum ]; then |
|
if [ -x ./a.out ]; then |
|
374 |
echo "OK" |
echo "OK" |
375 |
return 0 |
return 0 |
376 |
else |
else |
772 |
fi |
fi |
773 |
fi |
fi |
774 |
|
|
775 |
rm tmp_cmpnum.f a.out |
# rm -f tmp_cmpnum.f a.out |
776 |
|
rm -f tmp_cmpnum.c tmp_cmpnum |
777 |
|
|
778 |
if test "x$CLEANUP" != xt ; then |
if test "x$CLEANUP" != xt ; then |
779 |
cat $SUMMARY |
cat $SUMMARY |