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

SCM Repository

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

View of /branches/lamont/test/reduction/reduction-test.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2101 - (download) (annotate)
Thu Dec 6 06:37:07 2012 UTC (7 years, 3 months ago) by lamonts
File size: 881 byte(s)
Global Reduction code fixes
/*! \file reduction-test.diderot
 *
 * \author Lamont Samuels
 *
 * This example tests the global reductions operations. 
 */

/*
 * COPYRIGHT (c) 2012 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 */

real{} energies = load("energies.nrrd");
int nEnergies = length(energies);
strand Particle (real initEnergy) {
    real energy = initEnergy; 
    output real maxEnergy = 0.0;  

    update {
         int count = 45; 
         maxEnergy = max{P.energy | P in {Particle.active && Particle.stable}};
         real minEnergy = min{P.energy | P in {Particle.active && Particle.stable}};
         bool yes = xor{S.energy < 45 | S in {Particle.active}}; 
         print("****", "\n", maxEnergy, "\n", minEnergy, "\n", yes, "\n", "*****", "\n", "\n"); 
         stabilize; 
    }
}

initially [ Particle(energies{vi}) | vi in 0..(nEnergies-1)]; 

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