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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2183 - (view) (download)

1 : glk 2179
2 :     // For testing issues with adding or multiplying a scalar constant
3 :     // and a scalar field:
4 :     // NOTE: There are 6 different possible definitions of field GG below;
5 :     // uncomment one at a time. The definition inside "update" is the
6 :     // only one that isn't a compiler bug, but as explained its not where
7 :     // "GG = FF - sclr" would actually be used.
8 :    
9 :     // Process output with:
10 :     // 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
11 :    
12 :     input real sclr = 1.0;
13 :    
14 :     int gridSize = 200;
15 :     int stepsMax = 10;
16 :     real epsilon = 0.001;
17 :    
18 :     field#1(2)[] FF = ctmr ⊛ image("data/ddro.nrrd");
19 : jhr 2183 // the following bugs are because the negated sclr is not a global, but after
20 :     // normalization it is referenced in the strand body.
21 : glk 2179 /*
22 :     ** BUG: THIS is where it would make sense to define GG, and it doesn't work:
23 :     Internal error after normalization: see log file for details
24 :     */
25 : jhr 2183 // field#1(2)[] GG = FF - sclr;
26 : glk 2179 /*
27 :     ** BUG: For what its worth; this generates the same error
28 :     */
29 :     //field#1(2)[] GG = FF * sclr;
30 :     strand sample (vec2 pos0) {
31 :     output vec2 pos = pos0;
32 :     int steps = 0;
33 :     /*
34 :     ** BUG: Defining GG here doesn't work, but nor would it be a sensible place
35 :     ** to define the field; all strands should be using the same isocontour
36 :     uncaught exception Fail [Fail: probe: bogus field binding G0183 = RHS(self.G)]
37 :     raised at common/phase-timer.sml:76.50-76.52
38 :     raised at common/phase-timer.sml:76.50-76.52
39 :     raised at high-il/normalize.sml:240.18-242.11
40 :     */
41 :     //field#1(2)[] GG = FF - sclr;
42 :     /*
43 :     ** BUG: For what its worth; this generates the same error
44 :     */
45 :     //field#1(2)[] GG = FF * sclr;
46 :     update {
47 :     /*
48 :     ** Defining "GG = FF - sclr" here works, but its a strange place to
49 :     ** define the field for the sake of doing an isocontour: its not
50 :     ** really isocontouring if the isovalue could possibly change between
51 :     ** update iterations
52 :     */
53 : jhr 2183 //field#1(2)[] GG = FF - sclr;
54 : glk 2179 /*
55 :     ** BUG: can't multiply field by scalar:
56 :     ** Internal error after translation to MidIL: see log file for details
57 :     */
58 : jhr 2183 // FIXED
59 : glk 2179 //field#1(2)[] GG = FF * sclr;
60 :     vec2 grad = ∇GG(pos);
61 :     if (|grad| == 0) {
62 :     die;
63 :     }
64 :     vec2 delta = -(GG(pos)/|grad|)*normalize(grad);
65 :     if (|delta| < epsilon) {
66 :     stabilize;
67 :     }
68 :     pos += delta;
69 :     steps += 1;
70 :     if (!inside(pos, GG) || steps > stepsMax) {
71 :     die;
72 :     }
73 :     }
74 :     }
75 :    
76 :     initially { sample([lerp(0.0, 1.0, -0.5, real(ui), real(gridSize)-0.5),
77 :     lerp(0.0, 1.0, -0.5, real(vi), real(gridSize)-0.5)])
78 :     | vi in 0..(gridSize-1), ui in 0..(gridSize-1) };

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