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 2179 - (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 :     /*
20 :     ** BUG: THIS is where it would make sense to define GG, and it doesn't work:
21 :     Internal error after normalization: see log file for details
22 :     */
23 :     //field#1(2)[] GG = FF - sclr;
24 :     /*
25 :     ** BUG: For what its worth; this generates the same error
26 :     */
27 :     //field#1(2)[] GG = FF * sclr;
28 :     strand sample (vec2 pos0) {
29 :     output vec2 pos = pos0;
30 :     int steps = 0;
31 :     /*
32 :     ** BUG: Defining GG here doesn't work, but nor would it be a sensible place
33 :     ** to define the field; all strands should be using the same isocontour
34 :     uncaught exception Fail [Fail: probe: bogus field binding G0183 = RHS(self.G)]
35 :     raised at common/phase-timer.sml:76.50-76.52
36 :     raised at common/phase-timer.sml:76.50-76.52
37 :     raised at high-il/normalize.sml:240.18-242.11
38 :     */
39 :     //field#1(2)[] GG = FF - sclr;
40 :     /*
41 :     ** BUG: For what its worth; this generates the same error
42 :     */
43 :     //field#1(2)[] GG = FF * sclr;
44 :     update {
45 :     /*
46 :     ** Defining "GG = FF - sclr" here works, but its a strange place to
47 :     ** define the field for the sake of doing an isocontour: its not
48 :     ** really isocontouring if the isovalue could possibly change between
49 :     ** update iterations
50 :     */
51 :     field#1(2)[] GG = FF - sclr;
52 :     /*
53 :     ** BUG: can't multiply field by scalar:
54 :     ** Internal error after translation to MidIL: see log file for details
55 :     */
56 :     //field#1(2)[] GG = FF * sclr;
57 :     vec2 grad = ∇GG(pos);
58 :     if (|grad| == 0) {
59 :     die;
60 :     }
61 :     vec2 delta = -(GG(pos)/|grad|)*normalize(grad);
62 :     if (|delta| < epsilon) {
63 :     stabilize;
64 :     }
65 :     pos += delta;
66 :     steps += 1;
67 :     if (!inside(pos, GG) || steps > stepsMax) {
68 :     die;
69 :     }
70 :     }
71 :     }
72 :    
73 :     initially { sample([lerp(0.0, 1.0, -0.5, real(ui), real(gridSize)-0.5),
74 :     lerp(0.0, 1.0, -0.5, real(vi), real(gridSize)-0.5)])
75 :     | vi in 0..(gridSize-1), ui in 0..(gridSize-1) };

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