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

SCM Repository

[diderot] Annotation of /tests/lamont-tests/life.diderot
ViewVC logotype

Annotation of /tests/lamont-tests/life.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4640 - (view) (download)

1 : glk 4640
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 :     // ============================ begin setting up gridding of domain
11 :     vec2 xDom = [0,sizeX-1];
12 :     vec2 yDom = [0,sizeY-1];
13 :     real xSamples = floor((xDom[1] - xDom[0])/rr);
14 :     real ySamples = floor((yDom[1] - yDom[0])/rr);
15 :     vec4 qWinDim = [xDom[0],xDom[1],yDom[0],yDom[1]];
16 :     vec2 qGridDim = [xSamples,ySamples];
17 :     vec2 qCellDim = [(xDom[1] - xDom[0])/xSamples,(yDom[1] - yDom[0])/ySamples];
18 :     // ============================ end setting up gridding of domain
19 :    
20 :     strand cell (vec2 pos0, int val0) {
21 :     vec2 pos = pos0;
22 :     output int val = val0;
23 :     int iter = 0;
24 :    
25 :     update {
26 :     if (iter >= iterMax)
27 :     stabilize;
28 :     int nn = 0;
29 :     foreach (cell c in sphere(rr)) {
30 :     nn += c.val;
31 :     }
32 :     val = (1 if (3 == nn) else
33 :     (val if (2 == nn) else
34 :     0));
35 :     iter += 1;
36 :     }
37 :     }
38 :    
39 :     initially [ cell([ii, jj], 1 if init([ii,jj]) > 0.5 else 0)
40 :     | jj in 0..sizeY-1,
41 :     ii in 0..sizeX-1 ];

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