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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2562 - (download) (annotate)
Mon Mar 10 04:10:03 2014 UTC (5 years, 4 months ago) by lamonts
File size: 1078 byte(s)
Fixed bug with queryPool not allocating correctly and fixed deadlock of spatail data structure
/*! \file particle.diderot
 *
 * \author Lamont Samuels
 *
 * This example tests the spatial data structures and querying functions.  It also
 * serves as a test for loading data sequences.
 */

/*
 * COPYRIGHT (c) 2012 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 */
real{} posns = load("positions.nrrd");
int numParticles = 9;
int tempGlobal = 34; 
int  dimSize = 2; 
input real query_radius; 
 
strand Particle (int i, real x,real y) {
    vec2 pos = [x,y]; 
    int id = i; 
    output real neighborCount = 0;  
    update {
         int count = 0;
         print("======Strand id: #", id, " (", x, ",", y, ") Neigbors======\n"); 
         foreach(Particle p in sphere(query_radius)){ 
            print("Neighbor id: ", p.id, "\n"); 
            count = count + 1;
         }
         print("Count =",count,"\n"); 
         print("==================================\n"); 
         neighborCount = real(count); 
         stabilize; 
    }
}
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