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

SCM Repository

[diderot] Annotation of /branches/pure-cfg/test/fields.diderot
ViewVC logotype

Annotation of /branches/pure-cfg/test/fields.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1038 - (view) (download)

1 : glk 1020 // fields
2 :     //
3 :     // documents bugs in field expressions
4 :     // process output with:
5 :     // unu reshape -i mip.txt -s 2 300 200 | unu pad -min 0 0 0 -max 2 M M -b wrap | unu quantize -b 8 -o fields.png
6 : glk 933
7 :    
8 :     int imgSizeX = 300;
9 :     int imgSizeY = 200;
10 :    
11 :     image(2)[2] Vimg = load("../data/vorttest.nrrd");
12 :    
13 : jhr 1031 field#1(2)[2] Vpos = Vimg ⊛ ctmr;
14 :     field#1(2)[2] V1 = -Vpos;
15 : jhr 1033
16 : jhr 1031 field#1(2)[2] V2 = 1.0*(Vimg ⊛ ctmr);
17 : glk 933
18 : glk 1028 // (3) HEY (BUG): can't seem to even assign fields! This also fails:
19 : jhr 1031 //field#1(2)[2] V3 = Vpos;
20 : glk 933
21 : jhr 1031 field#1(2)[2] V4 = Vpos + Vpos;
22 : glk 933
23 : jhr 1031 //image(2)[] Rimg = load("../data/vorttest-rand.nrrd");
24 :     field#0(2)[] R = load("../data/vorttest-rand.nrrd") ⊛ tent;
25 : glk 933
26 :     strand LIC (int xi, int yi) {
27 :     real xx = lerp(0.0, 3.0, -0.5, real(xi), real(imgSizeX)-0.5);
28 :     real yy = lerp(0.0, 2.0, -0.5, real(yi), real(imgSizeY)-0.5);
29 :     vec2 pos = [xx,yy];
30 :     output vec2 v = [0.0,0.0];
31 :    
32 :     update {
33 : jhr 1031 v = (V1(pos) + V2(pos) /* + V3(pos)*/ + V4(pos)) * R(pos);
34 : glk 1038 // HEY (BUG): can't negate probing; this:
35 :     //v = -V1(pos);
36 :     // causes:
37 :     // fields.c:116: error: wrong type argument to decrement
38 :     // uncaught exception Fail [Fail: error compiling/linking]
39 :     // raised at c-target/run-cc.sml:31.17-31.47
40 : glk 933 stabilize;
41 :     }
42 :     }
43 :    
44 :     initially [ LIC(xi, yi) | yi in 0..(imgSizeY-1), xi in 0..(imgSizeX-1) ];

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