Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

[diderot] Diff of /branches/vis15/src/tests/lamont-tests/unit-circle.diderot
 [diderot] / branches / vis15 / src / tests / lamont-tests / unit-circle.diderot

# Diff of /branches/vis15/src/tests/lamont-tests/unit-circle.diderot

revision 4547, Fri Sep 9 01:42:59 2016 UTC revision 4548, Fri Sep 9 01:43:26 2016 UTC
# Line 1  Line 1
1    #version 2
2
3  // unit-circle  // unit-circle
4  //  //
5  // Demo of distributing particles on the unit circle  // Demo of distributing particles on the unit circle
6  //  //
8  int numOfParticles = length(initPosns)/2;  int numOfParticles = length(initPosns)/2;
9  input int iterMax = 300;  // maximum number of steps to run  input int iterMax = 300;  // maximum number of steps to run
10  input real rr = 0.5;      // actual particle radius  input real rr = 0.5;      // actual particle radius
# Line 83  Line 85
85      }      }
86  }  }
87
88    create_array {Particle(ii, initPosns[ii*2], initPosns[ii*2+1])
89               | ii in 0 .. numOfParticles-1 }
90
91  // can add statements in here to do some global computation  // can add statements in here to do some global computation
92  global{  update {
93    iter+=1;    iter+=1;
94    real var = variance{P.energy | P in Particle.all};  //  real var = variance{P.energy | P in Particle.all};
95      real avg = mean{P.energy | P in Particle.all};
96      real var = sum{(avg-P.energy)^2 | P in Particle.all};
97    stdev = sqrt(var);    stdev = sqrt(var);
98  }  }

initially {Particle(ii, initPosns{ii*2}, initPosns{ii*2+1})
| ii in 0 .. numOfParticles-1 };

Legend:
 Removed from v.4547 changed lines Added in v.4548