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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2101 - (view) (download)

1 : lamonts 2097 /*! \file reduction-test.diderot
2 :     *
3 :     * \author Lamont Samuels
4 :     *
5 :     * This example tests the global reductions operations.
6 :     */
7 :    
8 :     /*
9 :     * COPYRIGHT (c) 2012 The Diderot Project (http://diderot-language.cs.uchicago.edu)
10 :     * All rights reserved.
11 :     */
12 :    
13 : lamonts 2101 real{} energies = load("energies.nrrd");
14 :     int nEnergies = length(energies);
15 : lamonts 2097 strand Particle (real initEnergy) {
16 :     real energy = initEnergy;
17 :     output real maxEnergy = 0.0;
18 :    
19 :     update {
20 : lamonts 2101 int count = 45;
21 : lamonts 2097 maxEnergy = max{P.energy | P in {Particle.active && Particle.stable}};
22 : lamonts 2101 real minEnergy = min{P.energy | P in {Particle.active && Particle.stable}};
23 :     bool yes = xor{S.energy < 45 | S in {Particle.active}};
24 :     print("****", "\n", maxEnergy, "\n", minEnergy, "\n", yes, "\n", "*****", "\n", "\n");
25 : lamonts 2098 stabilize;
26 : lamonts 2097 }
27 :     }
28 :    
29 : lamonts 2101 initially [ Particle(energies{vi}) | vi in 0..(nEnergies-1)];

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