Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

[diderot] Diff of /branches/fem/test/lic.diderot
 [diderot] / branches / fem / test / lic.diderot

# Diff of /branches/fem/test/lic.diderot

revision 1334, Mon Jun 13 04:36:50 2011 UTC revision 1335, Mon Jun 13 04:38:15 2011 UTC
# Line 18  Line 18
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);
19      real yy = lerp(0.0, 2.0, -0.5, real(yi), real(imgSizeY)-0.5);      real yy = lerp(0.0, 2.0, -0.5, real(yi), real(imgSizeY)-0.5);
20      vec2 pos0 = [xx,yy];      vec2 pos0 = [xx,yy];
21      vec2 pos = [xx,yy];      vec2 forw = pos0;
22      bool forw;      vec2 back = pos0;
23      output real sum = R(pos0);      output real sum = R(pos0);
24      int step = 0;      int step = 0;
25
26      update {      update {
27            // Euler integration step
28            // forw = forw + h*V(forw);
29            // back = back - h*V(back);
30          // Midpoint method step          // Midpoint method step
31          if (forw) {          forw += h*V(forw + 0.5*h*V(forw));
32            pos += h*V(pos + 0.5*h*V(pos));          back -= h*V(back - 0.5*h*V(back));
sum += R(pos);
if (step == stepNum) {
forw = false;
}
} else {  // going backwards, not forward
pos -= h*V(pos - 0.5*h*V(pos));
sum += R(pos);
}
33          sum += R(forw) + R(back);          sum += R(forw) + R(back);
34            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            sum = |V(pos0)|*sum/real(1 + 2*stepNum);            sum = |V(pos0)|*sum/real(1 + 2*stepNum);

Legend:
 Removed from v.1334 changed lines Added in v.1335