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 3349 - (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 : 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 2099 * All rights reserved.
14 :     */
15 :     real{} posns = load("positions.nrrd");
16 : lamonts 2160 int numParticles = 9;
17 : lamonts 2203 int tempGlobal = 34;
18 : lamonts 2562 int dimSize = 2;
19 :     input real query_radius;
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 2562 output real neighborCount = 0;
25 : lamonts 2099 update {
26 :     int count = 0;
27 : lamonts 2416 print("======Strand id: #", id, " (", x, ",", y, ") Neigbors======\n");
28 : lamonts 2099 foreach(Particle p in sphere(query_radius)){
29 : lamonts 2162 print("Neighbor id: ", p.id, "\n");
30 : lamonts 2453 count = count + 1;
31 : lamonts 2099 }
32 : lamonts 2453 print("Count =",count,"\n");
33 : lamonts 2160 print("==================================\n");
34 : lamonts 2562 neighborCount = real(count);
35 : lamonts 2099 stabilize;
36 :     }
37 :     }
38 :     initially {Particle(i,posns{i*dimSize},posns{i*dimSize+1}) | i in 0 .. numParticles-1 };
39 : lamonts 2203
40 :    

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