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

SCM Repository

[diderot] View of /examples/iso2d-spatial/data/fsamp.diderot
 [diderot] / examples / iso2d-spatial / data / fsamp.diderot

View of /examples/iso2d-spatial/data/fsamp.diderot

Mon Mar 9 21:51:21 2015 UTC (4 years, 6 months ago) by glk
File size: 1370 byte(s)
`turns out this was a really challenging function for Newton-Raphson`
```input int size0 = 60;
input int size1 = 60;
input real width = 6;
input real shear = 0;
vec2 spacing = [width/(size0-1), width/(size1-1)];

input real theta = 0.0;
tensor[2,2] rot = [[cos(theta),sin(theta)],[-sin(theta),cos(theta)]];
vec2 dir0 = rotâ€¢[spacing[0], 0.0];
vec2 dir1 = rotâ€¢[0.0, spacing[1]] + shear*dir0;
vec2 orig = -(dir0*(size0-1) + dir1*(size1-1))/2.0;

function real func(vec2 pos) {
real x = pos[0];
real y = pos[1];
return 1+log(x^6 + y^6);
}

strand sample(int xi, int yi) {
output real vv = 0.0;
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: 2\n");
print("sizes: ", size0, " ", size1, "\n");
print("kinds: space space\n");
print("endian: little\n");
print("encoding: raw\n");
print("space dimension: 2\n");
print("space directions: (", dir0[0], ",", dir0[1],
") (", dir1[0], ",", dir1[1], ")\n");
print("space origin: (", orig[0], ",", orig[1], ")\n");
print("data file: vv.nrrd\n");
print("byte skip: -1\n");
}
vv = func(orig + xi*dir0 + yi*dir1);
stabilize;
}
}
initially [ sample(xi, yi) | yi in 0..(size1-1), xi in 0..(size0-1) ];
```

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