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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2120 - (view) (download)

1 : lamonts 2099 /*! \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 :    
9 :     /*
10 :     * COPYRIGHT (c) 2012 The Diderot Project (http://diderot-language.cs.uchicago.edu)
11 :     * All rights reserved.
12 :     */
13 :     real{} posns = load("positions.nrrd");
14 :     int numParticles = 64;
15 :     int dimSize = 2;
16 :     int strandSize = 2;
17 : lamonts 2120 real query_radius = 10.0;
18 : lamonts 2099
19 :     strand Particle (int i, real x,real y) {
20 :     vec2 pos = [x,y];
21 :     output int neighborCount = 0;
22 :     update {
23 :     int count = 0;
24 : lamonts 2120
25 : lamonts 2099 foreach(Particle p in sphere(query_radius)){
26 :     count = count + 1;
27 :     }
28 :     neighborCount = count;
29 :     stabilize;
30 :     }
31 :     }
32 :    
33 :     initially {Particle(i,posns{i*dimSize},posns{i*dimSize+1}) | i in 0 .. numParticles-1 };

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