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

SCM Repository

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

View of /branches/lamont/test/hlic/hlic-BUG5.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: 1670 byte(s)
Creating new developmented branch based on vis12
// Fixed in r1759 [JHR; 22-03-2012]
//

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

//field#1(2)[2] V0 = image("tor2slice-vec0.nrrd") ⊛ ctmr;
//field#1(2)[2] V1 = image("tor2slice-vec1.nrrd") ⊛ ctmr;
field#1(2)[2] V = image("tor2slice-vec0.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 pos0backup = [xx,yy];
    vec2 pos = pos0;
    vec2 step = [0.0,0.0];
    // output real out = 0.0;
    output vec3 out = [0.0,0.0,0.0];
    real sum = 0;
    int num = 0;
    real dir = 1.0;
    int mon = 0;

    update {
//      vec2 vv0 = V0(pos);
//      vec2 vv1 = V1(pos);
//      tensor[2,2] tt = [vv0,vv1];
      mon += 1;
      step = h*dir*V(pos);
      if (inside(pos + step, V)) {
        pos += step;
      }
      if (num == stepNum && dir > 0.0) {
        num = 0;
//        pos = pos0backup;
        pos = pos0;
        // BUG: saying "pos = pos0backup" vs "pos = pos0" above
        // produces different results in output (which includes
        // the components of pos) even though pos0 and pos0backup
        // should be identical
        dir = -1.0;
      }
      if (num == stepNum && dir < 0.0) {
        stabilize;
      }
      sum += R(pos);
      if (6 == mon) { stabilize; }    
      num += 1;
    }

    stabilize {
      out = [pos[0], pos[1], sum];
    }
}

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