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

SCM Repository

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

View of /branches/lamont/test/hlic/hlic-BUG11.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: 2397 byte(s)
Creating new developmented branch based on vis12
// fixed in r1785
// BUG:  don't know what line is causing this but compile fails with:
//uncaught exception Fail [Fail: getExp(_t07C9)]
//  raised at common/phase-timer.sml:76.50-76.52
//  raised at common/phase-timer.sml:76.50-76.52
//  raised at IL/value-numbering-fn.sml:47.36-47.83
//make: *** [hlic.o] Error 1


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("tor2slice-evec.nrrd") ⊛ ctmr;
field#1(2)[2] V0 = image("tor2slice-vec0.nrrd") ⊛ ctmr;
field#1(2)[2] V1 = image("tor2slice-vec1.nrrd") ⊛ ctmr;
//field#1(2)[2,2] T = image("tor2slice.nrrd") ⊛ ctmr;
//????: how should one load an image of tensor[2,2]?  as it is now:
///Users/gk/diderot/diderot/branches/vis12/bin/diderotc --namespace=HLIC --debug hlic.diderot
//[hlic.diderot] Error: image file "tor2slice.nrrd" has range tensor[4], expected tensor[2,2]
//uncaught exception Fail [Fail: Error in compiling hlic.diderot]
//  raised at common/phase-timer.sml:76.50-76.52
//  raised at common/phase-timer.sml:76.50-76.52
//  raised at driver/main.sml:27.39-27.76
//make: *** [hlic.o] Error 1
field#0(2)[] R = image("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([V0(pos),V1(pos)]){0} - evals([V0(pos),V1(pos)]){1};

    update {
      vec2 nondir = evecs([V0(pos),V1(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