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 2120 - (download) (annotate)
Thu Feb 7 13:46:31 2013 UTC (7 years, 3 months ago) by lamonts
File size: 829 byte(s)
Adding distance function and fixes to spatial communication
/*! \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 = 64;
int dimSize = 2; 
int strandSize = 2; 
real query_radius = 10.0; 
 
strand Particle (int i, real x,real y) {
    vec2 pos = [x,y]; 
    output int neighborCount = 0;  
    update {
         int count = 0;

         foreach(Particle p in sphere(query_radius)){ 
            count = count + 1;  
         }
         neighborCount = 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