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

SCM Repository

[diderot] Diff of /branches/vis12/test/iso2d.diderot
ViewVC logotype

Diff of /branches/vis12/test/iso2d.diderot

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1927, Sat Jun 23 18:09:16 2012 UTC revision 2173, Sat Feb 23 15:49:20 2013 UTC
# Line 5  Line 5 
5  // step of Newton-Raphson.  // step of Newton-Raphson.
6  //  //
7  // Process output with:  // Process output with:
8  // unu jhisto -i iso2d.txt -b 512 512 -min 0 0 -max 1 1 | unu 2op neq - 0 | unu quantize -b 8  -o iso2d.png  // unu jhisto -i pos.nrrd -b 512 512 -min 0 0 -max 1 1 | unu 2op neq - 0 | unu quantize -b 8  -o iso2d.png
9    
10  int gridSize = 300;  int gridSize = 300;
11  field#1(2)[] F = ctmr ⊛ image("../data/ddro-80.nrrd");  field#1(2)[] F = ctmr ⊛ image("../data/ddro-80.nrrd");
# Line 21  Line 21 
21                                   else 10.0;                                   else 10.0;
22      int steps = 0;      int steps = 0;
23      update {      update {
24            field#1(2)[] G = F - isoval;
25          // We bail if we're no longer inside or taken too many steps.          // We bail if we're no longer inside or taken too many steps.
26          if (!inside(pos, F) || steps > stepsMax) {          if (!inside(pos, G) || steps > stepsMax) {
27              die;              die;
28          }          }
29          // GLKs recent changes (revision 1329) were made to make the code          // GLKs recent changes (revision 1329) were made to make the code
30          // a more obvious implementation of Newton-Raphson, and also to create          // a more obvious implementation of Newton-Raphson, and also to create
31          // some obvious and not-so-obvious opportunties for optimization          // some obvious and not-so-obvious opportunties for optimization
32          vec2 grad = ∇F(pos);          vec2 grad = ∇G(pos);
33          if (|grad| == 0.0) {    // can't compute step if |∇F|, so have to bail          if (|grad| == 0.0) {    // can't compute step if |∇F|, so have to bail
34              die;              die;
35          }          }
36          vec2 norm = normalize(grad);          vec2 norm = normalize(grad);
37          vec2 delta = -((F(pos) - isoval)/|grad|)*norm;  // Newton-Raphson step          vec2 delta = -(G(pos)/|grad|)*norm;  // Newton-Raphson step
38          if (|delta| < epsilon) {    // we've converged if step is small enough          if (|delta| < epsilon) {    // we've converged if step is small enough
39              stabilize;              stabilize;
40          }          }

Legend:
Removed from v.1927  
changed lines
  Added in v.2173

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