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 933 - (view) (download)

1 : glk 933
2 :    
3 :     int imgSizeX = 300;
4 :     int imgSizeY = 200;
5 :    
6 :     image(2)[2] Vimg = load("../data/vorttest.nrrd");
7 :    
8 :     // HEY (BUG) I *can* say the following:
9 :     // field#1(2)[2] Vpos = Vimg ⊛ ctmr; field#1(2)[2] V = -Vpos;
10 :     // but trying to do that with one statement, below, causes:
11 :     // uncaught exception Fail [Fail: Error in compiling fneg.diderot]
12 :     // raised at driver/main.sml:31.39-31.76
13 :     field#1(2)[2] V = -(Vimg ⊛ ctmr);
14 :    
15 :     // HEY (BUG) I thought we had scalar multiplication of fields? this:
16 :     //field#1(2)[2] Vpos = Vimg ⊛ ctmr; field#1(2)[2] V = 1.0*Vpos;
17 :     // causes:
18 :     // translate (V00E2, *001E, ...)
19 :     // uncaught exception Fail [Fail: TranslateBasis.translate: unknown basis function *001E]
20 :     // raised at translate/translate-basis.sml:192.41-192.43
21 :     // raised at translate/translate-basis.sml:189.22-189.100
22 :     //
23 :     // should also have? field#1(2)[2] V = 1.0*(Vimg ⊛ ctmr);
24 :    
25 :     // HEY (BUG): can't seem to even assign fields! This also fails:
26 :     // field#1(2)[2] Vpos = Vimg ⊛ ctmr; field#1(2)[2] V = Vpos;
27 :    
28 :     // HEY (BUG): I thought we had addition of fields? This also fails:
29 :     //field#1(2)[2] Vpos = Vimg ⊛ ctmr; field#1(2)[2] V = Vpos + Vpos;
30 :    
31 :     image(2)[] Rimg = load("../data/vorttest-rand.nrrd");
32 :     field#0(2)[] R = Rimg ⊛ tent;
33 :    
34 :     strand LIC (int xi, int yi) {
35 :     real xx = lerp(0.0, 3.0, -0.5, real(xi), real(imgSizeX)-0.5);
36 :     real yy = lerp(0.0, 2.0, -0.5, real(yi), real(imgSizeY)-0.5);
37 :     vec2 pos = [xx,yy];
38 :     output vec2 v = [0.0,0.0];
39 :    
40 :     update {
41 :     v = V(pos);
42 :     stabilize;
43 :     }
44 :     }
45 :    
46 :     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