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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1868 - (download) (annotate)
Fri May 11 03:17:42 2012 UTC (7 years, 5 months ago) by lamonts
File size: 708 byte(s)
Major Progress with the FOREACH statment
int worldWidth = 500;
int worldHeight = 500;
int particleRadius = 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 count = 0;
         int step = 3; 
         int b = 2; 
        foreach(Particle p in radius(5.0)){ 
        //  neighbor[count] = p.id; 
            count = count + 1; 
            b = count + 2;  
          }
         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