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

SCM Repository

[diderot] Annotation of /benchmarks/programs/ridge3d/bmark-diderot.diderot
ViewVC logotype

Annotation of /benchmarks/programs/ridge3d/bmark-diderot.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1588 - (view) (download)

1 : glk 1582
2 :     int gridSize = 120;
3 :     field#2(3)[] F = bspln3 ⊛ load("../../data/lungcrop.nrrd");
4 : glk 1588 input int stepsMax = 30;
5 :     input real epsilon = 0.001;
6 :     input real travelMax = 5.0;
7 :     input real strnMin = 170.0;
8 : glk 1582
9 :     strand sample (int ui, int vi, int wi) {
10 :     output vec3 pos = [lerp(21.6401, 21.6401 + 140.0*0.5,
11 :     -0.5, real(ui), real(gridSize)-0.5),
12 :     lerp(-175.8792, -175.8792 + 200.0*0.5,
13 :     -0.5, real(vi), real(gridSize)-0.5),
14 :     lerp(-188.0000, -188.0000 + 140.0*0.5,
15 :     -0.5, real(wi), real(gridSize)-0.5)];
16 :     int steps = 0;
17 :     real travel = 0.0;
18 :     update {
19 :     if (!inside(pos, F) || steps > stepsMax || travel > travelMax) {
20 :     die;
21 :     }
22 :     real gmag = |∇F(pos)|;
23 :     if (gmag == 0.0) { // can't compute step if |∇F|, so have to bail
24 :     die;
25 :     }
26 :     vec3 grad = ∇F(pos);
27 :     tensor[3,3] hess = ∇⊗∇F(pos);
28 :    
29 :    
30 :     real{3} eval = evals(hess);
31 : glk 1588 real strn = -eval{1};
32 : glk 1582 vec3{3} evec = evecs(hess);
33 :     vec3 dir = normalize((evec{2}⊗evec{2} + evec{1}⊗evec{1})•grad);
34 :    
35 :     real fdd = grad•dir;
36 :     real sdd = dir•hess•dir;
37 :     vec3 delta = (0.1 if sdd >= 0.0 else -fdd/sdd)*dir;
38 :     if (|delta| < epsilon) {
39 : glk 1588 if (strn >= strnMin) {
40 : glk 1582 stabilize;
41 :     }
42 :     die;
43 :     }
44 :     // BUG: can't have: else {
45 :     pos += delta;
46 :     steps += 1;
47 :     travel += |delta|;
48 :     // BUG: can't have: }
49 :     }
50 :     }
51 :    
52 :     initially { sample(ui, vi, wi) |
53 :     wi in 0..(gridSize-1),
54 :     vi in 0..(gridSize-1),
55 :     ui in 0..(gridSize-1) };

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