| 13 |
|
my $td = `mktemp -d /tmp/genBSDF.XXXXXX`; |
| 14 |
|
chomp $td; |
| 15 |
|
my $nsamp = 1000; |
| 16 |
+ |
my $rtargs = "-w -ab 5 -ad 700 -lw 3e-6"; |
| 17 |
|
my $mgfin = 0; |
| 18 |
|
my $geout = 1; |
| 19 |
|
my $nproc = 1; |
| 24 |
|
while ($#ARGV >= 0) { |
| 25 |
|
if ("$ARGV[0]" =~ /^[-+]m/) { |
| 26 |
|
$mgfin = ("$ARGV[0]" =~ /^\+/); |
| 27 |
+ |
} elsif ("$ARGV[0]" eq "-r") { |
| 28 |
+ |
$rtargs = "$rtargs $ARGV[1]"; |
| 29 |
+ |
shift @ARGV; |
| 30 |
|
} elsif ("$ARGV[0]" =~ /^[-+]g/) { |
| 31 |
|
$geout = ("$ARGV[0]" =~ /^\+/); |
| 32 |
|
} elsif ("$ARGV[0]" =~ /^[-+]f/) { |
| 70 |
|
} |
| 71 |
|
print STDERR "Warning: Device extends into room\n" if ($dim[5] > 1e-5); |
| 72 |
|
# Add receiver surfaces (rectangular) |
| 69 |
– |
my $bmodnm="receiver_behind"; |
| 73 |
|
my $fmodnm="receiver_face"; |
| 74 |
+ |
my $bmodnm="receiver_behind"; |
| 75 |
|
open(RADSCN, ">> $radscn"); |
| 76 |
< |
print RADSCN "void glow $fmodnm\n0\n0\n4 0 0 0 0\n\n"; |
| 77 |
< |
print RADSCN "$fmodnm polygon f_receiver\n0\n0\n12\n"; |
| 78 |
< |
print RADSCN "\t",$dim[0],"\t",$dim[2],"\t",$dim[5]+2e-5,"\n"; |
| 79 |
< |
print RADSCN "\t",$dim[0],"\t",$dim[3],"\t",$dim[5]+2e-5,"\n"; |
| 76 |
< |
print RADSCN "\t",$dim[1],"\t",$dim[3],"\t",$dim[5]+2e-5,"\n"; |
| 77 |
< |
print RADSCN "\t",$dim[1],"\t",$dim[2],"\t",$dim[5]+2e-5,"\n"; |
| 78 |
< |
print RADSCN "void glow $bmodnm\n0\n0\n4 0 0 0 0\n\n"; |
| 79 |
< |
print RADSCN "$bmodnm polygon b_receiver\n0\n0\n12\n"; |
| 80 |
< |
print RADSCN "\t",$dim[1],"\t",$dim[2],"\t",$dim[4]-2e-5,"\n"; |
| 81 |
< |
print RADSCN "\t",$dim[1],"\t",$dim[3],"\t",$dim[4]-2e-5,"\n"; |
| 82 |
< |
print RADSCN "\t",$dim[0],"\t",$dim[3],"\t",$dim[4]-2e-5,"\n"; |
| 83 |
< |
print RADSCN "\t",$dim[0],"\t",$dim[2],"\t",$dim[4]-2e-5,"\n"; |
| 76 |
> |
print RADSCN "void glow $fmodnm\n0\n0\n4 1 1 1 0\n\n"; |
| 77 |
> |
print RADSCN "$fmodnm source f_receiver\n0\n0\n4 0 0 1 180\n"; |
| 78 |
> |
print RADSCN "void glow $bmodnm\n0\n0\n4 1 1 1 0\n\n"; |
| 79 |
> |
print RADSCN "$bmodnm source b_receiver\n0\n0\n4 0 0 -1 180\n"; |
| 80 |
|
close RADSCN; |
| 81 |
|
# Generate octree |
| 82 |
|
system "oconv -w $radscn > $octree"; |
| 138 |
|
my @tbarr; |
| 139 |
|
my @rbarr; |
| 140 |
|
my $cmd; |
| 145 |
– |
my $rtargs = "-w -ab 5 -ad 700 -lw 3e-6"; |
| 141 |
|
my $rtcmd = "rtcontrib -h -ff -fo -n $nproc -c $nsamp " . |
| 142 |
|
"-e '$kcal' -b kbin -bn $ndiv " . |
| 143 |
|
"-o '$td/%s.flt' -m $fmodnm -m $bmodnm $rtargs $octree"; |
| 148 |
|
$cmd = "cnt $ndiv $ny $nx | rcalc -of -e '$tcal' " . |
| 149 |
|
"-e 'xp=(\$3+rand(.35*recno-15))*(($dim[1]-$dim[0])/$nx)+$dim[0]' " . |
| 150 |
|
"-e 'yp=(\$2+rand(.86*recno+11))*(($dim[3]-$dim[2])/$ny)+$dim[2]' " . |
| 151 |
< |
"-e 'zp:$dim[4]-1e-5' " . |
| 151 |
> |
"-e 'zp:$dim[4]' " . |
| 152 |
|
q{-e 'Kbin=$1;x1=rand(1.21*recno+2.75);x2=rand(-3.55*recno-7.57)' } . |
| 153 |
< |
q{-e '$1=xp;$2=yp;$3=zp;$4=Dx;$5=Dy;$6=Dz' } . |
| 153 |
> |
q{-e '$1=xp-Dx;$2=yp-Dy;$3=zp-Dz;$4=Dx;$5=Dy;$6=Dz' } . |
| 154 |
|
"| $rtcmd"; |
| 155 |
|
system "$cmd" || die "Failure running: $cmd\n"; |
| 156 |
|
@tfarr = `$rccmd $td/$fmodnm.flt`; |
| 162 |
|
$cmd = "cnt $ndiv $ny $nx | rcalc -of -e '$tcal' " . |
| 163 |
|
"-e 'xp=(\$3+rand(.35*recno-15))*(($dim[1]-$dim[0])/$nx)+$dim[0]' " . |
| 164 |
|
"-e 'yp=(\$2+rand(.86*recno+11))*(($dim[3]-$dim[2])/$ny)+$dim[2]' " . |
| 165 |
< |
"-e 'zp:$dim[5]+1e-5' " . |
| 165 |
> |
"-e 'zp:$dim[5]' " . |
| 166 |
|
q{-e 'Kbin=$1;x1=rand(1.21*recno+2.75);x2=rand(-3.55*recno-7.57)' } . |
| 167 |
< |
q{-e '$1=xp;$2=yp;$3=zp;$4=-Dx;$5=-Dy;$6=-Dz' } . |
| 167 |
> |
q{-e '$1=xp+Dx;$2=yp+Dy;$3=zp+Dz;$4=-Dx;$5=-Dy;$6=-Dz' } . |
| 168 |
|
"| $rtcmd"; |
| 169 |
|
system "$cmd" || die "Failure running: $cmd\n"; |
| 170 |
|
@tbarr = `$rccmd $td/$bmodnm.flt`; |