--- ray/src/gen/glaze.csh 2003/02/22 02:07:23 2.1 +++ ray/src/gen/glaze.csh 2004/08/25 19:13:30 2.5 @@ -1,13 +1,21 @@ #!/bin/csh -f -# RCSid: $Id: glaze.csh,v 2.1 2003/02/22 02:07:23 greg Exp $ +# RCSid: $Id: glaze.csh,v 2.5 2004/08/25 19:13:30 greg Exp $ # # Complex glazing model (goes with glaze1.cal and glaze2.cal) # # Oct. 2002 Greg Ward +# Aug. 2004 GW (added -f option to read glazings from file) +# Funding for this development generously provided by Visarc, Inc. +# (http://www.visarc.com) # ################################################################# # +# The general assumption is that one surface is uncoated, and +# reflectances and transmittances are computed from this fact. +# If the user tries to enter two coated surfaces on the same +# pane, the script complains and exits. +# # Supported surface types: # set sn_arr=("clear glass" "VE1-2M low-E coating" "PVB laminated" "V-175 white frit" "V-933 warm gray frit") @@ -25,6 +33,44 @@ set tn_g_arr=(0.890 0.808 0.63 0.21 0.09) set tn_b_arr=(0.886 0.744 0.63 0.21 0.09) # Boolean whether coatings can have partial coverage: set part_arr=(0 0 0 1 1) + +while ($#argv > 0) + set header="Surface Tr Tg Tb Rcr Rcg Rcb Rgr Rgg Rgb Part" + if ($#argv < 2 || "$argv[1]" != '-f') then + echo "Usage: $0 [-f glazing.dat ..]" + exit 1 + endif + shift argv + set gf="$argv[1]" + shift argv + if ("`sed -n 1p $gf:q`" != "$header") then + echo "Bad header in $gf -- Expected: $header" + exit 1 + endif + echo "Adding glazing types from file $gf :" + set nl=`wc -l < $gf:q` + @ i=2 + while ($i <= $nl) + set ln=(`sed -n ${i}p $gf:q`) + if ($#ln != 11) then + echo "Expected 11 words in line: $ln" + exit 1 + endif + echo $ln[1] + set sn_arr=($sn_arr:q $ln[1]) + set tn_r_arr=($tn_r_arr $ln[2]) + set tn_g_arr=($tn_g_arr $ln[3]) + set tn_b_arr=($tn_b_arr $ln[4]) + set rc_r_arr=($rc_r_arr $ln[5]) + set rc_g_arr=($rc_g_arr $ln[6]) + set rc_b_arr=($rc_b_arr $ln[7]) + set rg_r_arr=($rg_r_arr $ln[8]) + set rg_g_arr=($rg_g_arr $ln[9]) + set rg_b_arr=($rg_b_arr $ln[10]) + set part_arr=($part_arr $ln[11]) + @ i++ + end +end ################################################################# #