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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1582 - (download) (annotate)
Mon Oct 31 04:20:56 2011 UTC (9 years, 11 months ago) by glk
File size: 1763 byte(s)
new benchmark, not finished yet
int gridSize = 120;
field#2(3)[] F = bspln3 ⊛ load("../../data/lungcrop.nrrd");
input int stepsMax = 20;
input real epsilon = 0.005;
real travelMax = 5.0;

strand sample (int ui, int vi, int wi) {
    output vec3 pos = [lerp(21.6401, 21.6401 + 140.0*0.5,
                              -0.5, real(ui), real(gridSize)-0.5),
                       lerp(-175.8792, -175.8792 + 200.0*0.5, 
                              -0.5, real(vi), real(gridSize)-0.5),
                       lerp(-188.0000, -188.0000 + 140.0*0.5,
                              -0.5, real(wi), real(gridSize)-0.5)];
    int steps = 0;
    real travel = 0.0;
    update {
        if (!inside(pos, F) || steps > stepsMax || travel > travelMax) {
	    die;
        }
        real gmag = |∇F(pos)|;
        if (gmag == 0.0) {    // can't compute step if |∇F|, so have to bail
	    die;
        }
        vec3 grad = ∇F(pos);
        tensor[3,3] hess = ∇⊗∇F(pos);

        
        real{3} eval = evals(hess);
        real strn = -eval{2};
        vec3{3} evec = evecs(hess);
        vec3 dir = normalize((evec{2}⊗evec{2} + evec{1}⊗evec{1})•grad);
        /*
        vec3 dir = normalize(grad);
        real strn = 0.0;
        */

        real fdd = grad•dir;
        real sdd = dir•hess•dir;
        vec3 delta = (0.1 if sdd >= 0.0 else -fdd/sdd)*dir;
        if (|delta| < epsilon) {
           if (strn >= 300.0) {
             stabilize;
           }
           die;
        }
        // BUG: can't have:   else {
        pos += delta;
        steps += 1;
        travel += |delta|;
        // BUG: can't have:   }
    }
}

initially { sample(ui, vi, wi) | 
             wi in 0..(gridSize-1), 
             vi in 0..(gridSize-1), 
             ui in 0..(gridSize-1) };

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