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

SCM Repository

[diderot] Annotation of /branches/lamont/test/particle.diderot
ViewVC logotype

Annotation of /branches/lamont/test/particle.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2091 - (view) (download)

1 : lamonts 2091 /*! \file particle.diderot
2 :     *
3 :     * \author Lamont Samuels
4 :     *
5 :     * This example tests the spatial data structures and querying functions. It also
6 :     * serves as a test for loading data sequences.
7 :     */
8 : lamonts 2083
9 : lamonts 2091 /*
10 :     * COPYRIGHT (c) 2012 The Diderot Project (http://diderot-language.cs.uchicago.edu)
11 :     * All rights reserved.
12 :     */
13 :     int{} args = load("positions.nrrd");
14 :     int nArgs = length(args);
15 : lamonts 2090 int strandSize = 4;
16 : lamonts 2083
17 :     // Particle(x,y)
18 :     strand Particle (int x, int y) {
19 :     vec2 pos = [real(x),real(y)];
20 :     int id = x * worldWidth + y;
21 :     vec4 neighbor = [0.0, 0.0, 0.0, 0.0];
22 :     // output vec4 neighbors = [0.0, 0.0, 0.0, 0.0];
23 :     output int neighborCount = 0;
24 :    
25 :     update {
26 :     int t = 3;
27 : lamonts 2090 int count = strandSize;
28 : lamonts 2083 foreach(Particle p in sphere(5)){
29 :     t = p.id;
30 :     count = count + 1 + t;
31 :     }
32 :     neighborCount = count;
33 :     stabilize;
34 :     }
35 :     }
36 :    
37 :     initially [ Particle(ui, vi) | vi in 0..(worldHeight-1), ui in 0..(worldWidth-1) ];

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