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 3349 - (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 : jhr 3349 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
11 :     *
12 :     * COPYRIGHT (c) 2015 The University of Chicago
13 : lamonts 2091 * All rights reserved.
14 :     */
15 :     int{} args = load("positions.nrrd");
16 :     int nArgs = length(args);
17 : lamonts 2090 int strandSize = 4;
18 : lamonts 2083
19 :     // Particle(x,y)
20 :     strand Particle (int x, int y) {
21 :     vec2 pos = [real(x),real(y)];
22 :     int id = x * worldWidth + y;
23 :     vec4 neighbor = [0.0, 0.0, 0.0, 0.0];
24 :     // output vec4 neighbors = [0.0, 0.0, 0.0, 0.0];
25 :     output int neighborCount = 0;
26 :    
27 :     update {
28 :     int t = 3;
29 : lamonts 2090 int count = strandSize;
30 : lamonts 2083 foreach(Particle p in sphere(5)){
31 :     t = p.id;
32 :     count = count + 1 + t;
33 :     }
34 :     neighborCount = count;
35 :     stabilize;
36 :     }
37 :     }
38 :    
39 :     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