ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/dayfact.csh
Revision: 1.4
Committed: Wed Jun 5 14:01:20 1991 UTC (32 years, 10 months ago) by greg
Content type: application/x-csh
Branch: MAIN
Changes since 1.3: +18 -12 lines
Log Message:
made rtrace run in background

File Contents

# Content
1 #!/bin/csh -f
2 # SCCSid "$SunId$ LBL"
3 #
4 # Interactive script to calculate daylight factors
5 #
6 set nofile="none"
7 set genskyf=$nofile
8 set octree=$nofile
9 set dfpict=$nofile
10 set ilpict=$nofile
11 set fcopts=($*)
12 set wporig=(0 0 0)
13 set wpsize=(1 1)
14 set rtargs=(-ab 1 -ad 256 -as 128 -aa .15 -av .1 .1 .1)
15
16 set maxres=128
17 set iltemp=/usr/tmp/il$$.pic
18 set sctemp=/usr/tmp/sc$$.csh
19 set tempfiles=($iltemp $sctemp)
20
21 alias readvar 'echo -n Enter \!:1 "[$\!:1]: ";set ans="$<";if("$ans" != "")set \!:1="$ans"'
22
23 cat <<_EOF_
24 DAYLIGHT FACTOR CALCULATION
25
26 This script calculates daylight factors and/or illuminance levels on a
27 rectangular workplane and produces a contour plot from the result. The
28 input is a Radiance scene description (and octree) and the output is one
29 or more color Radiance pictures.
30
31 _EOF_
32 readvar octree
33 if ( "$octree" == "$nofile" || ! -f "$octree" ) then
34 echo "You must first create an octree with oconv"
35 echo "before running this script."
36 exit 1
37 endif
38 echo "In what scene file is the gensky command located?"
39 readvar genskyf
40 if ( "$genskyf" == "$nofile" || ! -r "$genskyf" ) then
41 echo "You will not be able to compute"
42 echo "daylight factors without a gensky file"
43 else
44 set extamb=`xform -e $genskyf|sed -n 's/^# Ground ambient level: //p'`
45 endif
46 echo -n "Is the z-axis your zenith direction? "
47 if ( "$<" !~ [yY]* ) then
48 echo "I'm sorry, you cannot use this script"
49 exit 1
50 endif
51 echo "What is the origin (smallest x y z coordinates) of the workplane?"
52 readvar wporig
53 set wporig=($wporig)
54 echo "What is the x and y size (width and length) of the workplane?"
55 readvar wpsize
56 set wpsize=($wpsize)
57 set wpres=(`rcalc -n -e '$1=if(l,'"floor($maxres*$wpsize[1]/$wpsize[2]),$maxres);"'$2=if(l,'"$maxres,floor($maxres*$wpsize[2]/$wpsize[1]));l=$wpsize[2]-$wpsize[1]"`)
58 set rtargs=($rtargs -ar `getinfo -d<$octree|rcalc -e '$1=floor(16*$4/'"($wpsize[1]+$wpsize[2]))"`)
59 echo "What calculation options do you want to give to rtrace?"
60 echo "(It is very important to set the -a? options correctly.)"
61 readvar rtargs
62 echo "Illuminance contour picture if you want one"
63 readvar ilpict
64 if ( $?extamb ) then
65 echo "Daylight factor contour picture if you want one"
66 readvar dfpict
67 endif
68 if ( "$ilpict" == "$nofile" && "$dfpict" == "$nofile" ) then
69 echo "Since you don't want any output, I guess we're done."
70 exit 0
71 endif
72 cat <<'_EOF_' > $sctemp
73 onintr quit
74 echo "Your dayfact job is finished."
75 echo "Please check for error messages below."
76 echo ""
77 set echo
78 cnt $wpres[2] $wpres[1] \
79 | rcalc -e '$1=($2+.5)/'"$wpres[1]*$wpsize[1]+$wporig[1]" \
80 -e '$2=(1-($1+.5)/'"$wpres[2])*$wpsize[2]+$wporig[2]" \
81 -e '$3='"$wporig[3]" -e '$4=0;$5=0;$6=1' \
82 | rtrace $rtargs -I -ov -faf $octree \
83 | pvalue -r -x $wpres[1] -y $wpres[2] -df \
84 | pfilt -h 20 -n 0 -x 350 -y 350 -p 1 -r 1 > $iltemp
85 set maxval=`getinfo < $iltemp | rcalc -i 'EXPOSURE=${e}' -e '$1=3/e'`
86 '_EOF_'
87 if ( "$ilpict" != "$nofile" ) then
88 echo 'falsecolor -cb -l Lux $fcopts -s "$maxval*470" -m 470 \\
89 -pi $iltemp > $ilpict' >> $sctemp
90 endif
91 if ( "$dfpict" != "$nofile" ) then
92 echo 'falsecolor -cb -l DF $fcopts -s "$maxval/$extamb" \\
93 -m "1/$extamb" -pi $iltemp > $dfpict' >> $sctemp
94 endif
95 echo 'rm -f $tempfiles' >> $sctemp
96 (source $sctemp) |& mail `whoami` &
97 echo "Your job is started in the background."
98 echo "I will send you mail when it is done."