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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2091 - (download) (annotate)
Mon Nov 12 01:54:01 2012 UTC (6 years, 11 months ago) by lamonts
File size: 977 byte(s)
Added support for setting grid size
/*! \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.
 */
int{} args = load("positions.nrrd");
int nArgs = length(args);
int strandSize = 4; 

// Particle(x,y) 
strand Particle (int x, int y) {
    vec2 pos = [real(x),real(y)]; 
    int id = x * worldWidth + y;  
    vec4 neighbor = [0.0, 0.0, 0.0, 0.0];
  //  output vec4 neighbors = [0.0, 0.0, 0.0, 0.0];
    output int neighborCount = 0;  

    update {
         int t = 3; 
         int count = strandSize;
         foreach(Particle p in sphere(5)){ 
            t = p.id; 
            count = count + 1  + t; 
          }
         neighborCount = count; 
         stabilize; 
    }
}

initially [ Particle(ui, vi) | vi in 0..(worldHeight-1), ui in 0..(worldWidth-1) ];

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0