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

SCM Repository

[diderot] View of /branches/vis12/test/hlic/hlic-BUG10.diderot
ViewVC logotype

View of /branches/vis12/test/hlic/hlic-BUG10.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1777 - (download) (annotate)
Sun Apr 1 10:31:03 2012 UTC (7 years, 4 months ago) by glk
File size: 1444 byte(s)
tweak
// BUG:
// output is different with different runs, in a seemingly non-deterministic way
// to test: do "./hlic && unu minmax out.nrrd" about 20 times

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] V = load("tor2slice-vec0.nrrd") ⊛ ctmr;
field#0(2)[] R = load("tor2slice-rand.nrrd") ⊛ tent;

strand LIC (int xi, int yi) {
    vec2 pos0 = [lerp(0.0, 79.0, -0.5, real(xi), real(imgSize)-0.5),
                 lerp(0.0, 79.0, -0.5, real(yi), real(imgSize)-0.5)];
    vec2 pos = pos0;
    vec2 step = [0.0,0.0];
    //output vec3 out = [0.0,0.0,0.0];
    output real out = 0.0;
    //BUG9: if out is type vec3, program works ok;
    //  if type is real; then program segfaults
    real sum = 0.0;
    int num = 0;
    real dir = 1.0;
    print ("======== start starting at ", pos0, "\n");
    //BUG10: can't print in strand initialization

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

    stabilize {
      //out = [pos[0], pos[1], sum];
      out = 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