Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

[diderot] View of /branches/charisee/ertest/vispaper/hi/lapliso2d.diderot
 [diderot] / branches / charisee / ertest / vispaper / hi / lapliso2d.diderot

# View of /branches/charisee/ertest/vispaper/hi/lapliso2d.diderot

Thu Feb 26 18:36:36 2015 UTC (4 years, 5 months ago) by cchiw
File size: 1388 byte(s)
`a`
```/*
\$DDRO_HOME/branches/vis12/bin/diderotc --exec lapliso2d.diderot \
&& ./lapliso2d \
&& unu jhisto -i x.nrrd -b 800 800 -min 0 0 -max 1 1 \
| unu 2op neq - 0 \
| unu quantize -b 8 -o lapliso2d.png
*/
// Checked log file by hand, but no nrrd file.
// I'm not sure how to write this in the vis branch.

input real isoval = 0.5;
field#2(2)[] V = bspln3 ⊛ load("../../../data/ddro.nrrd");
field#1(2)[] Laplacian = ∇•∇V;

int grid = 150;
int stepsMax = 10;
real epsilon = 0.000001;

strand RootFind(int ui, int vi) {

output vec2 x=[ lerp(0, 1, -0.5, ui, grid-0.5),
lerp(0, 1, -0.5, vi, grid-0.5)];
int steps = 0;
update {
// Stop if we're no longer inside or taken too many steps.
if (!inside(x, V) || steps > stepsMax)
die;

real m=mag(x);

// subsequent expressions are undefined if |∇(∇•∇V)| is zero
if (m == 0.0)
die;
// the Newton-Raphson step
vec2 delta = deltaF(x);

// we've converged if the change is small enough
if (|delta| < epsilon)
stabilize;
x -= delta;
steps += 1;
}
}

initially [RootFind(ui,vi)
| vi in 0..(grid-1), ui in 0..(grid-1) ];

```