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

SCM Repository

[diderot] View of /tests/lamont-tests/particle.diderot
ViewVC logotype

View of /tests/lamont-tests/particle.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4640 - (download) (annotate)
Tue Sep 27 20:54:47 2016 UTC (2 years, 9 months ago) by glk
File size: 1131 byte(s)
initial result of svn export --username anonsvn --password=anonsvn https://svn.smlnj-gforge.cs.uchicago.edu/svn/diderot/branches/vis15/src/tests/
/*! \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.
 */

/*
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2015 The University of Chicago
 * 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