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 2162 - (download) (annotate)
Thu Feb 21 04:59:17 2013 UTC (7 years, 4 months ago) by lamonts
File size: 1071 byte(s)
Fixed bugs in my grid.h from new spatial implementation
/*! \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 dimSize = 2;  
vec4 qWinDim = [0,400,0,400];
vec2 qGridDim = [4,4];
vec2 qCellDim = [100,100];  
real query_radius = 100.0; 
 
strand Particle (int i, real x,real y) {
    vec2 pos = [x,y]; 
    int id = i; 
    output int neighborCount = 0;  
    update {
         int count = 0;
         print("======Strand id: #", id, " Neigbors======\n"); 
         foreach(Particle p in sphere(query_radius)){ 
            print("Neighbor id: ", p.id, "\n"); 
            count = count;
         }
         print("==================================\n"); 
         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