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 2160 - (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 : lamonts 2160 int numParticles = 9;
15 :     int dimSize = 2;
16 :     vec2 qGridDim = [4,4];
17 :     vec2 qCellDim = [100,100];
18 : lamonts 2120 real query_radius = 10.0;
19 : lamonts 2099
20 :     strand Particle (int i, real x,real y) {
21 :     vec2 pos = [x,y];
22 : lamonts 2160 int id = i;
23 : lamonts 2099 output int neighborCount = 0;
24 :     update {
25 :     int count = 0;
26 : lamonts 2160 print("======Strand id: #", id, " Neigbors======\n");
27 : lamonts 2099 foreach(Particle p in sphere(query_radius)){
28 : lamonts 2160 print("Neighbor id: ", p.id);
29 :     count = count;
30 : lamonts 2099 }
31 : lamonts 2160 print("==================================\n");
32 : lamonts 2099 neighborCount = count;
33 :     stabilize;
34 :     }
35 :     }
36 :    
37 :     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