519 |
#include <math.h> |
#include <math.h> |
520 |
int main( int argc, char** argv ) { |
int main( int argc, char** argv ) { |
521 |
int linnum,best,lncnt; |
int linnum,best,lncnt; |
522 |
double a,b,diff; |
double a,b,abave,relerr; |
523 |
best = -16; |
best = -22; |
524 |
lncnt = 0; |
lncnt = 0; |
525 |
while( 1 & (lncnt+=1) < 999 ) { |
while( 1 & (lncnt+=1) < 999 ) { |
526 |
scanf("%d", &linnum); |
scanf("%d", &linnum); |
527 |
if (linnum == -1) break; |
if (linnum == -1) break; |
528 |
scanf("%lf", &a); scanf("%lf", &b); |
scanf("%lf", &a); scanf("%lf", &b); |
529 |
diff = 0.5*(fabs(a)+fabs(b)); |
abave = 0.5*(fabs(a)+fabs(b)); |
530 |
if (diff > 0.0) { |
if (abave > 0.0) { |
531 |
diff=fabs(a-b)/diff; |
relerr=fabs(a-b)/abave; |
532 |
if (diff > 1.e-12) { |
if (relerr > 0.0) { linnum = (int)log10(relerr); } |
533 |
linnum = (int)log10(diff); |
else { linnum = -16 ; } |
534 |
best = (best > linnum) ? best : linnum; |
best = (best > linnum) ? best : linnum; |
|
} |
|
|
else { |
|
|
if (best == -16 && diff != 0) best = -22; |
|
|
} |
|
535 |
} |
} |
536 |
} |
} |
537 |
if (lncnt == 999) best=-29; |
if (lncnt == 999) best=-29; |
539 |
return 0; |
return 0; |
540 |
} |
} |
541 |
EOF |
EOF |
542 |
cc -o tmp_cmpnum tmp_cmpnum.c -lm |
$CC -o tmp_cmpnum tmp_cmpnum.c -lm |
543 |
|
|
544 |
if [ -x ./tmp_cmpnum ]; then |
if [ -x ./tmp_cmpnum ]; then |
545 |
echo "OK" |
echo "OK" |
546 |
return 0 |
return 0 |
547 |
else |
else |
548 |
echo |
echo |
549 |
echo "ERROR: failed to compile comparison code" |
echo "ERROR: failed to compile comparison code -- please specify" |
550 |
|
echo " a C compiler using the CC environment variable." |
551 |
exit 1 |
exit 1 |
552 |
fi |
fi |
553 |
} |
} |
878 |
fout= |
fout= |
879 |
if test "x$ADM" = x ; then |
if test "x$ADM" = x ; then |
880 |
fout=$dir"/results/output.txt" |
fout=$dir"/results/output.txt" |
|
check_for_add_mon_output $fout |
|
881 |
else |
else |
882 |
fout=$dir"/results_ad/output.txt_adm" |
fout=$dir"/results_ad/output.txt_adm" |
883 |
fi |
fi |
885 |
echo "can't read \"$fout\" -- skipping $dir" |
echo "can't read \"$fout\" -- skipping $dir" |
886 |
continue |
continue |
887 |
fi |
fi |
888 |
|
if test "x$ADM" = x ; then |
889 |
|
check_for_add_mon_output $fout |
890 |
|
fi |
891 |
|
|
892 |
# Check for additional types of monitor output |
# Check for additional types of monitor output |
893 |
|
|
965 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
966 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
967 |
|
|
|
OLD_COMMAND=$COMMAND |
|
|
COMMAND="./mitgcmuv > output.txt" |
|
968 |
for ex in $extra_runs ; do |
for ex in $extra_runs ; do |
969 |
test -e "$dir/tr_run.$ex" && rm -rf "$dir/tr_run.$ex" |
test -e "$dir/tr_run.$ex" && rm -rf "$dir/tr_run.$ex" |
970 |
mkdir "$dir/tr_run.$ex" |
mkdir "$dir/tr_run.$ex" |
997 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
998 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
999 |
done |
done |
|
COMMAND=$OLD_COMMAND |
|
1000 |
else |
else |
1001 |
fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` |
fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` |
1002 |
fres=$fres"$results $dir" |
fres=$fres"$results $dir" |