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

SCM Repository

[diderot] Diff of /branches/pure-cfg/test/lic.diderot
ViewVC logotype

Diff of /branches/pure-cfg/test/lic.diderot

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 938, Fri Apr 22 13:50:26 2011 UTC revision 1039, Sun May 1 21:20:35 2011 UTC
# Line 11  Line 11 
11  real h = 0.01;    // step size of integration  real h = 0.01;    // step size of integration
12  int stepNum = 25; // take this many steps both upstream and downstream  int stepNum = 25; // take this many steps both upstream and downstream
13    
14  image(2)[2] Vimg = load("../data/vorttest.nrrd");  field#1(2)[2] V = load("../data/vorttest.nrrd") ⊛ ctmr;
15  field#1(2)[2] V = Vimg ⊛ ctmr;  field#0(2)[] R = load("../data/vorttest-rand.nrrd") ⊛ tent;
 image(2)[] Rimg = load("../data/vorttest-rand.nrrd");  
 field#0(2)[] R = Rimg ⊛ tent;  
16    
17  strand LIC (int xi, int yi) {  strand LIC (int xi, int yi) {
18      real xx = lerp(0.0, 3.0, -0.5, real(xi), real(imgSizeX)-0.5);      real xx = lerp(0.0, 3.0, -0.5, real(xi), real(imgSizeX)-0.5);
# Line 22  Line 20 
20      vec2 pos0 = [xx,yy];      vec2 pos0 = [xx,yy];
21      vec2 forw = pos0;      vec2 forw = pos0;
22      vec2 back = pos0;      vec2 back = pos0;
23      output real avg = R(pos0);      output real sum = R(pos0);
24      int step = 0;      int step = 0;
25    
26      update {      update {
# Line 32  Line 30 
30          // Midpoint method step          // Midpoint method step
31          forw = forw + h*V(forw + 0.5*h*V(forw));          forw = forw + h*V(forw + 0.5*h*V(forw));
32          back = back - h*V(back - 0.5*h*V(back));          back = back - h*V(back - 0.5*h*V(back));
33          avg = avg + R(forw) + R(back);          sum = sum + R(forw) + R(back);
34          step = step + 1;          step = step + 1;
35          if (step == stepNum) {          if (step == stepNum) {
36            // modulate output by velocity at initial position            // modulate output by velocity at initial position
37            avg = |V(pos0)|*avg/real(1 + 2*stepNum);            sum = |V(pos0)|*sum/real(1 + 2*stepNum);
38            stabilize;            stabilize;
39          }          }
40      }      }

Legend:
Removed from v.938  
changed lines
  Added in v.1039

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