Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Annotation of /branches/vis12/bugs/bug013.diderot
ViewVC logotype

Annotation of /branches/vis12/bugs/bug013.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2195 - (view) (download)

1 : jhr 2195 // For testing issues with adding or multiplying a scalar constant
2 :     // and a scalar field:
3 :     // NOTE: There are 6 different possible definitions of field GG below;
4 :     // uncomment one at a time. The definition inside "update" is the
5 :     // only one that isn't a compiler bug, but as explained its not where
6 :     // "GG = FF - sclr" would actually be used.
7 :    
8 :     // Process output with:
9 :     // unu jhisto -i pos.nrrd -b 200 200 -min 0 0 -max 1 1 | unu 2op neq - 0 | unu quantize -b 8 -o iso2d.png
10 :    
11 :     input real sclr = 1.0;
12 :    
13 :     int gridSize = 200;
14 :     int stepsMax = 10;
15 :     real epsilon = 0.001;
16 :    
17 :     field#1(2)[] FF = ctmr ⊛ image("data/ddro.nrrd");
18 :    
19 :     strand sample (vec2 pos0) {
20 :     output vec2 pos = pos0;
21 :     int steps = 0;
22 :     /*
23 :     ** BUG: Defining GG here doesn't work:
24 :     **
25 :     uncaught exception Fail [Fail: probe: bogus field binding GG0185 = RHS(self.GG)]
26 :     raised at common/phase-timer.sml:76.50-76.52
27 :     raised at common/phase-timer.sml:76.50-76.52
28 :     raised at high-il/normalize.sml:244.18-246.11
29 :     */
30 :     field#1(2)[] GG = FF - sclr;
31 :     update {
32 :     vec2 grad = ∇GG(pos);
33 :     if (|grad| == 0) {
34 :     die;
35 :     }
36 :     vec2 delta = -(GG(pos)/|grad|)*normalize(grad);
37 :     if (|delta| < epsilon) {
38 :     stabilize;
39 :     }
40 :     pos += delta;
41 :     steps += 1;
42 :     if (!inside(pos, GG) || steps > stepsMax) {
43 :     die;
44 :     }
45 :     }
46 :     }
47 :    
48 :     initially { sample([lerp(0.0, 1.0, -0.5, real(ui), real(gridSize)-0.5),
49 :     lerp(0.0, 1.0, -0.5, real(vi), real(gridSize)-0.5)])
50 :     | vi in 0..(gridSize-1), ui in 0..(gridSize-1) };

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0