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 2453 - (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 : lamonts 2203 int tempGlobal = 34;
16 : lamonts 2160 int dimSize = 2;
17 : lamonts 2416 real query_radius = 60.5;
18 : lamonts 2099
19 :     strand Particle (int i, real x,real y) {
20 :     vec2 pos = [x,y];
21 : lamonts 2160 int id = i;
22 : lamonts 2099 output int neighborCount = 0;
23 :     update {
24 :     int count = 0;
25 : lamonts 2416 print("======Strand id: #", id, " (", x, ",", y, ") Neigbors======\n");
26 : lamonts 2099 foreach(Particle p in sphere(query_radius)){
27 : lamonts 2162 print("Neighbor id: ", p.id, "\n");
28 : lamonts 2453 count = count + 1;
29 : lamonts 2099 }
30 : lamonts 2453 print("Count =",count,"\n");
31 : lamonts 2160 print("==================================\n");
32 : lamonts 2453 neighborCount = count;
33 : lamonts 2099 stabilize;
34 :     }
35 :     }
36 :     initially {Particle(i,posns{i*dimSize},posns{i*dimSize+1}) | i in 0 .. numParticles-1 };
37 : lamonts 2203
38 :    

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