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

SCM Repository

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

Annotation of /branches/vis12/bugs/resolved/bug024.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2343 - (view) (download)

1 : glk 2334
2 :     vec2 {} x0s = load("../data/seeds.txt");
3 :     int x0num = length(x0s);
4 :     real h = 0.02;
5 :     int stepNum = 130;
6 :     input real arrow = 0.4;
7 :    
8 :     field#1(2)[2] V = bspln3 ⊛ image("../data/flow.nrrd");
9 :     field#1(2)[2] ins = bspln3 ⊛ image("../data/flow-crop.nrrd");
10 :    
11 :     strand sline (int ii, vec2 x0) {
12 :     int step = 0;
13 :     vec2 xf = x0;
14 :     output vec2{} path = {x0};
15 :     vec2 aa = [0,0];
16 :     vec2 bb = [0,0];
17 :    
18 :     update {
19 :     if (inside(xf, ins))
20 :     xf += h*V(xf + 0.5*h*V(xf));
21 :     if (inside(xf, ins))
22 :     path = path @ xf;
23 :     step += 1;
24 :     if (step == stepNum) {
25 :     vec2 f = arrow*V(xf);
26 :     vec2 p = 0.4*[-f[1],f[0]];
27 :     /* BUG: can't append an expression to a sequence:
28 :     bug024.c:460:66: error: address expression must be an lvalue or a function designator
29 :     Diderot_DynSeqAppend(sizeof(vec2f_t), l_path_99, &(l__t_152+l_p_151)),...
30 :     ^ ~~~~~~~~~~~~~~~~
31 :     */
32 :     path = path @ (xf - f + p);
33 :     path = path @ (xf - f - p);
34 :     path = path @ xf;
35 : jhr 2343 /* and BUG: try making local variables for these, as with: */
36 : glk 2334 vec2 aa = (xf - f + p);
37 :     vec2 bb = (xf - f - p);
38 :     path = path @ aa;
39 : jhr 2343 path = bb @ path;
40 : glk 2334 path = path @ xf;
41 : jhr 2343 /* that won't work either. and BUG, nor can you make aa and bb local to update.
42 : glk 2334 It only works if aa and bb are strand variables */
43 :     stabilize;
44 :     }
45 :     }
46 :     }
47 :    
48 :     initially [ sline(ii, x0s{ii}) | ii in 0..x0num-1 ];

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