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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2591 - (download) (annotate)
Thu Apr 17 20:39:44 2014 UTC (6 years, 9 months ago) by glk
File size: 2063 byte(s)
another bug
/*
** BUG
** diderotc --exec bug030.diderot
** generates:

uncaught exception Fail [Fail: unknown variable _t0149]
  raised at common/phase-timer.sml:76.50-76.52
  raised at common/phase-timer.sml:76.50-76.52
  raised at simplify/inliner.sml:26.20-26.64

** GLK has not had the time to narrow down what is causing the error
*/

input int size = 100;
input real width = 2;
real spc = width/real(size-1);
real phi=0;

real eps = 0.0001;
vec2 crit1 = [0.7+eps, -0.5+eps];
vec2 crit2 = [-0.7+eps, 0.5+eps];

input bool bar = true;

function vec2 foo(vec2 v) {
  if (bar) {
    return [-v[1], v[0]]/(|v|^2);
  } else {
    return [-v[1], v[0]];
 }
}

function vec2 ff(vec2 xy) {
  vec2 r1 = xy - crit1;  // r = radial vector
  vec2 r2 = xy - crit2;
  real w1 = 1;
  real w2 = 1;
//  real w1 = 1/(|r1|^2);
//  real w2 = 1/(|r2|^2);
  return (w1*foo(r1) - w2*foo(r2))/(w1 + w2);
}

strand sample(int xi, int yi) {
  output vec2 vv = [0.00000001,0];
  tensor[2,2] rot = [[cos(phi),sin(phi)],[-sin(phi),cos(phi)]];
  real diag = spc*real(size-1)/2;
  vec2 orig = rot•[-diag, -diag];
  vec2 xdir = rot•[spc, 0.0];
  vec2 ydir = rot•[0.0, spc];
  vec2 xy = [nan,nan];
  update {
    if (0 == xi && 0 == yi) {
      print("NRRD0004\n");
      print("# Complete NRRD file format specification at:\n");
      print("# http://teem.sourceforge.net/nrrd/format.html\n");
      print("type: float\n");
      print("dimension: 3\n");
      print("sizes: 2 ", size, " ", size, "\n");
      print("kinds: 2-vector space space\n");
      print("endian: little\n");
      print("encoding: raw\n");
      print("space dimension: 2\n");
      print("space directions: none (", xdir[0], ",", xdir[1], ") (", ydir[0], ",", ydir[1], ")\n");
      print("space origin: (", orig[0], ",", orig[1], ")\n");
      print("data file: vv.nrrd\n");
      print("byte skip: -1\n");
    }
    xy  = orig + xi*xdir + yi*ydir;
    vv = ff(xy);
    stabilize;
  }
  stabilize {
    //print("666 ", xy[0], " ", xy[1], "\n");
  }
}
initially [ sample(xi, yi) | yi in 0..(size-1), xi in 0..(size-1) ];

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