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

SCM Repository

[diderot] Annotation of /tests/vis15-bugs/gst2d.diderot
ViewVC logotype

Annotation of /tests/vis15-bugs/gst2d.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4640 - (view) (download)

1 : glk 4640 #version 2
2 :    
3 :     /*
4 :     Compiling the attached program generates an error:
5 :    
6 :     [gst2d.diderot:32.22-32] Error: "stabilize" statment outside of initially/update method
7 :    
8 :     The stabilize is inside an update, but its the global update not the strand update.
9 :    
10 :     Being able to stabilize all strands from the global update, as a consequence of some
11 :     computation done in the global update, is a natural way to express the convergence of
12 :     particle systems. Also, this was part of Lamont's branch, and it was used in Fig 2 of
13 :     the Vis'15 paper, so I hope that the merge will include this important capability.
14 :    
15 :     */
16 :     /*const*/ int N = 10;
17 :     real target = 0.0;
18 :    
19 :     strand S (int i) {
20 :     output real e = i;
21 :     int iter = 0;
22 :    
23 :     update {
24 :     iter += 1;
25 :     real delta = (target - e)/2 + iter;
26 :     print (i, "(", iter, "): e = ", e, ", delta = ", delta, "\n");
27 :     // if (target > 10) { stabilize; } // works, but ugly
28 :     if (|delta| < 0.001) {
29 :     stabilize;
30 :     } else {
31 :     e += delta;
32 :     }
33 :     }
34 :    
35 :     }
36 :    
37 :     start {
38 :     target = mean { p.e | p in S.all };
39 :     print("initially: target = ", target, "\n");
40 :     }
41 :    
42 :     update {
43 :     target = sum { p.e | p in S.all } / N;
44 :     print("update: target = ", target, "\n");
45 :     if (target > 10) { stabilize; }
46 :     print("update done\n");
47 :     }
48 :    
49 :     create_collection { S(i) | i in 1..N }

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