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

SCM Repository

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

View of /branches/lamont/test/hlic/hlic-BUG2.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2081 - (download) (annotate)
Mon Nov 5 23:26:06 2012 UTC (7 years ago) by lamonts
File size: 1503 byte(s)
Creating new developmented branch based on vis12
// This now produces [JHR; 22-03-2012]
//
// 3
// 1.0607667
// 1

int imgSize = 200;
real h = 0.3;    // step size of integration
int stepNum = 2; // take this many steps both upstream and downstream

field#1(2)[2] V = image("tor2slice-evec.nrrd") ⊛ ctmr;
field#0(2)[] R = image("tor2slice-rand.nrrd") ⊛ tent;

strand LIC (int xi, int yi) {
    real xx = lerp(0.0, 79.0, -0.5, real(xi), real(imgSize)-0.5);
    real yy = lerp(0.0, 79.0, -0.5, real(yi), real(imgSize)-0.5);
    vec2 pos0 = [xx,yy];
    vec2 pos = pos0;
    vec2 step = [0.0,0.0];
    output vec3 out = [0.0,0.0,0.0];
    real sum = 0.0;
    int num = 0;
    int mon = 0;
    real dir = 1.0;

    update {
      step = 0.5*h*dir*V(pos);
      if (inside(pos + step, V)) {
        step = h*dir*V(pos + step);
        if (inside(pos + step, V)) {
          pos += step;
        }
      }
      if (num == stepNum) {
        if (dir > 0.0) {
          num = 0;
          pos = pos0;
          dir = -1.0;
        } else {
          stabilize;
        }
      }
      sum += R(pos);
      num += 1;
      mon += 1;

      if (3 == mon) {
        stabilize;
      }
    }

    stabilize {
      out = [real(num),sum,dir];
      // BUG:
      // unu slice -i out.nrrd -a 1 -p 50 | unu slice -a 1 -p 50 | unu save -f text
      // outputs: "3    -0.61486632    0" (on one line)
      // implying that dir has been set to 0, but dir has never been set to zero!
    }
}

initially [ LIC(xi, yi) | yi in 0..(imgSize-1), xi in 0..(imgSize-1) ];

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