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

SCM Repository

[diderot] Annotation of /branches/lamont/test/life-global.diderot
ViewVC logotype

Annotation of /branches/lamont/test/life-global.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2354 - (view) (download)

1 : glk 2354
2 :     input int iterMax = 50;
3 :     int sizeX = 640;
4 :     int sizeY = 480;
5 :     real rr = sqrt(2)+0.001;
6 :    
7 :     //field#0(2)[] init = tent ⊛ image("../data/life-ggun.nrrd");
8 :     field#0(2)[] init = tent ⊛ image("../data/life-breeder.nrrd");
9 :    
10 :     int iter = 0;
11 :    
12 :     // ============================ begin setting up gridding of domain
13 :     vec2 xDom = [0,sizeX-1];
14 :     vec2 yDom = [0,sizeY-1];
15 :     real xSamples = floor((xDom[1] - xDom[0])/rr);
16 :     real ySamples = floor((yDom[1] - yDom[0])/rr);
17 :     vec4 qWinDim = [xDom[0],xDom[1],yDom[0],yDom[1]];
18 :     vec2 qGridDim = [xSamples,ySamples];
19 :     vec2 qCellDim = [(xDom[1] - xDom[0])/xSamples,(yDom[1] - yDom[0])/ySamples];
20 :     // ============================ end setting up gridding of domain
21 :    
22 :     strand cell (vec2 pos0, int val0) {
23 :     vec2 pos = pos0;
24 :     output int val = val0;
25 :    
26 :     update {
27 :     if (iter >= iterMax)
28 :     stabilize;
29 :     int nn = 0;
30 :     foreach (cell c in sphere(rr)) {
31 :     nn += c.val;
32 :     }
33 :     val = (1 if (3 == nn) else
34 :     (val if (2 == nn) else
35 :     0));
36 :     }
37 :     }
38 :    
39 :     global {
40 :     iter += 1;
41 :     print("iter = ", iter, "\n");
42 :     }
43 :    
44 :     initially [ cell([ii, jj], 1 if init([ii,jj]) > 0.5 else 0)
45 :     | jj in 0..sizeY-1,
46 :     ii in 0..sizeX-1 ];

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