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 2416 - (download) (annotate)
Mon Aug 19 12:57:45 2013 UTC (5 years, 10 months ago) by lamonts
File size: 1090 byte(s)
Adding KDTree code for c-tagert and parallel c-target
/*! \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;  
real query_radius = 60.5; 
 
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, " (", x, ",", y, ") Neigbors======\n"); 
         foreach(Particle p in sphere(query_radius)){ 
            print("Neighbor id: ", p.id, "\n"); 
            count = count;
         }
         print("==================================\n"); 
         neighborCount = count + tempGlobal; 
         stabilize; 
    }
}

global{ 
    tempGlobal = tempGlobal + 2; 
} 

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