--- ray/src/cv/optics2rad.csh 2006/05/19 21:33:12 2.2 +++ ray/src/cv/optics2rad.csh 2008/08/25 04:50:31 2.3 @@ -1,5 +1,5 @@ #!/bin/csh -f -# RCSid $Id: optics2rad.csh,v 2.2 2006/05/19 21:33:12 greg Exp $ +# RCSid $Id: optics2rad.csh,v 2.3 2008/08/25 04:50:31 greg Exp $ # # Convert Optics 5 output to correct Radiance input # @@ -7,7 +7,8 @@ if ($#argv < 1) then echo "Usage: $0 optics.mat .." exit 1 endif -cat > /tmp/opt.fmt << '_EOF_' +set optf=`mktemp /tmp/optfmt.XXXXXXX` +cat > $optf << '_EOF_' void glass $(name)_glass 0 0 @@ -35,7 +36,8 @@ void BRTDfunc $(name)_back echo "# Output generated by $0 from $*" sed -e '/^[^#]/d' -e '/^$/d' $* -cat > /tmp/out$$.fmt << '_EOF_' +set outf=`mktemp /tmp/outfmt.XXXXXX` +cat > $outf << '_EOF_' void glass $(name) 0 @@ -48,9 +50,9 @@ rcalc -l -e 'abs(x):if(x,x,-x);and(a,b):if(a,b,a);not( -e 'trans=lum(Rtau,Gtau,Btau)' \ -e 'rfront=lum(fRrho,fGrho,fBrho);rback=lum(bRrho,bGrho,bBrho)' \ -e 'cond=0.005-abs(rfront-rback)' \ - -i /tmp/opt.fmt -o /tmp/out$$.fmt $* + -i $optf -o $outf $* -cat > /tmp/out$$.fmt << '_EOF_' +cat > $outf << '_EOF_' void BRTDfunc $(name) 10 @@ -69,9 +71,9 @@ rcalc -l -e 'abs(x):if(x,x,-x);and(a,b):if(a,b,a);not( -e 'trans=lum(Rtau,Gtau,Btau)' \ -e 'rfront=lum(fRrho,fGrho,fBrho);rback=lum(bRrho,bGrho,bBrho)' \ -e 'cond=and(trans-.645, not(0.005-abs(rfront-rback)))' \ - -i /tmp/opt.fmt -o /tmp/out$$.fmt $* + -i $optf -o $outf $* -cat > /tmp/out$$.fmt << '_EOF_' +cat > $outf << '_EOF_' void BRTDfunc $(name) 10 @@ -90,6 +92,6 @@ rcalc -l -e 'abs(x):if(x,x,-x);and(a,b):if(a,b,a);not( -e 'trans=lum(Rtau,Gtau,Btau)' \ -e 'rfront=lum(fRrho,fGrho,fBrho);rback=lum(bRrho,bGrho,bBrho)' \ -e 'cond=and(not(trans-.645), not(0.005-abs(rfront-rback)))' \ - -i /tmp/opt.fmt -o /tmp/out$$.fmt $* + -i $optf -o $outf $* -rm -f /tmp/opt.fmt /tmp/out$$.fmt +rm -f $optf $outf