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