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

SCM Repository

[diderot] View of /branches/vis12/bugs/open/bug047.diderot
ViewVC logotype

View of /branches/vis12/bugs/open/bug047.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3386 - (download) (annotate)
Mon Nov 9 22:02:09 2015 UTC (4 years, 7 months ago) by jhr
File size: 2640 byte(s)
reducing the size of the test case for bug 47
/*
** This program from 2012 apparently compiled with r1785, but no longer
** Compiling with: ../../bin/diderotc --exec bug047.diderot
** generates:
[bug047.diderot:15.1-81.0] Warning: global variable 'V0' declared at [bug047.diderot:20.1-21.0]  is unused
[bug047.diderot:15.1-81.0] Warning: global variable 'V1' declared at [bug047.diderot:21.1-22.0]  is unused
*** dump environment
  evals0E0D --> DEF l_evals_155
  dir0E17 --> DEF l_dir_160
  step0E1A --> DEF l_step_161
  sum0E8B --> DEF l_sum_186
  pos0E8C --> DEF l_pos_187
  sign0E99 --> DEF l_sign_190
  stepIdx0E9C --> DEF l_stepIdx_189
  out0BFD --> DEF
***
uncaught exception Fail [Fail: useVar(stepIdx0E9B)]
  raised at common/phase-timer.sml:78.50-78.52
  raised at common/phase-timer.sml:78.50-78.52
  raised at common/phase-timer.sml:78.50-78.52
  raised at tree-il/low-to-tree-fn.sml:136.7-136.50

*/

int imgSize = 400;
//real hh = 0.2;    // step size of integration
int stepNum = 20; // take this many steps both upstream and downstream

//field#1(2)[2] V = image("../data/tor2slice-evec.nrrd") ⊛ ctmr;
//field#1(2)[2] V0 = image("../data/tor2slice-vec0.nrrd") ⊛ ctmr;
//field#1(2)[2] V1 = image("../data/tor2slice-vec1.nrrd") ⊛ ctmr;
//field#1(2)[2,2] T = image("../data/tor2slice.nrrd") ⊛ ctmr;
//field#0(2)[] R = image("../data/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 real out = 0.0;
//    real sum = 0.0;
    int stepIdx = 0;
    real sign = 1.0;
//    vec2 refdir = [0.0,0.0];
//    vec2 dir = [0.0,0.0];
    //real aniso = evals(T(pos)){0} - evals(T(pos)){1};
    //real aniso = evals([V0(pos),V1(pos)]){0} - evals([V0(pos),V1(pos)]){1};

    update {
      //vec2 nondir = evecs([V0(pos),V1(pos)]){0};
//      vec2 nondir = evecs(T(pos)){0};
//      if (0 == stepIdx) {
//        refdir = sign*nondir;
//        dir = refdir;
//      } else {
//        dir = nondir if (nondir•refdir >= 0.0) else -nondir;
//        refdir = dir;
//      }
//      step = hh*dir;
//      if (inside(pos + step, V) && inside(pos + step, R)) {
//        pos += step;
//        sum += R(pos);
//      }
      if (stepIdx == stepNum) {
        if (sign > 0.0) {
          sign = -1.0;
          stepIdx = 0;
          pos = pos0;
        } else {
          stabilize;
        }
      } else {
        stepIdx += 1;
      }
    }

    stabilize {
//      out = sum*aniso;
    }
}

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