ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/genBSDF.pl
(Generate patch)

Comparing ray/src/util/genBSDF.pl (file contents):
Revision 2.24 by greg, Tue Aug 23 14:02:41 2011 UTC vs.
Revision 2.27 by greg, Thu Oct 27 16:35:54 2011 UTC

# Line 16 | Line 16 | chomp $td;
16   my @savedARGV = @ARGV;
17   my $tensortree = 0;
18   my $ttlog2 = 4;
19 < my $nsamp = 10000;
19 > my $nsamp = 2000;
20   my $rtargs = "-w -ab 5 -ad 700 -lw 3e-6";
21   my $mgfin = 0;
22   my $geout = 1;
23   my $nproc = 1;
24   my $doforw = 0;
25   my $doback = 1;
26 + my $pctcull = 95;
27   my $gunit = "Meter";
28   my @dim;
29   # Get options
# Line 43 | Line 44 | while ($#ARGV >= 0) {
44                  $doforw = ("$ARGV[0]" =~ /^\+/);
45          } elsif ("$ARGV[0]" =~ /^[-+]b/) {
46                  $doback = ("$ARGV[0]" =~ /^\+/);
47 +        } elsif ("$ARGV[0]" eq "-t") {
48 +                $pctcull = $ARGV[1];
49 +                shift @ARGV;
50          } elsif ("$ARGV[0]" =~ /^-t[34]$/) {
51                  $tensortree = substr($ARGV[0], 2, 1);
52                  $ttlog2 = $ARGV[1];
# Line 149 | Line 153 | print
153   </WindowElement>
154   ';
155   # Clean up temporary files and exit
152 if ( $persistfile && open(PFI, "< $persistfile") ) {
153        while (<PFI>) {
154                s/^[^ ]* //;
155                kill('ALRM', $_);
156                last;
157        }
158        close PFI;
159 }
156   exec("rm -rf $td");
157  
158   #-------------- End of main program segment --------------#
159  
160 + #++++++++++++++ Kill persistent rtrace +++++++++++++++++++#
161 + sub persist_end {
162 +        if ( $persistfile && open(PFI, "< $persistfile") ) {
163 +                while (<PFI>) {
164 +                        s/^[^ ]* //;
165 +                        kill('ALRM', $_);
166 +                        last;
167 +                }
168 +                close PFI;
169 +        }
170 + }
171 +
172   #++++++++++++++ Tensor tree BSDF generation ++++++++++++++#
173   sub do_tree_bsdf {
174   # Get sampling rate and subdivide task
# Line 236 | Line 244 | if ( $doback ) {
244                  die "rtcontrib process reported error" if ( $? );
245                  $npleft++;
246          }
247 +        persist_end();
248          ttree_out(0);
249   }
250   if ( $doforw ) {
# Line 252 | Line 261 | if ( $doforw ) {
261                  die "rtcontrib process reported error" if ( $? );
262                  $npleft++;
263          }
264 +        persist_end();
265          ttree_out(1);
266   }
267   }       # end of sub do_tree_bsdf()
# Line 328 | Line 338 | print
338   system "rcalc -if3 -e 'Omega:PI/($ns*$ns)' " .
339          q{-e '$1=(0.265*$1+0.670*$2+0.065*$3)/Omega' -of } .
340          "$td/" . ($bmodnm,$fmodnm)[$forw] . "_???.flt " .
341 <        "| rttree_reduce -h -ff -r $tensortree -g $ttlog2";
341 >        "| rttree_reduce -h -ff -t $pctcull -r $tensortree -g $ttlog2";
342   die "Failure running rttree_reduce" if ( $? );
343   print
344   '                       </ScatteringData>
# Line 354 | Line 364 | print
364   system "rcalc -if3 -e 'Omega:PI/($ns*$ns)' " .
365          q{-e '$1=(0.265*$1+0.670*$2+0.065*$3)/Omega' -of } .
366          "$td/" . ($fmodnm,$bmodnm)[$forw] . "_???.flt " .
367 <        "| rttree_reduce -h -ff -r $tensortree -g $ttlog2";
367 >        "| rttree_reduce -h -ff -t $pctcull -r $tensortree -g $ttlog2";
368   die "Failure running rttree_reduce" if ( $? );
369   print
370   '                       </ScatteringData>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines