Home My Page Projects Code Snippets Project Openings diderot

SCM Repository

[diderot] Diff of /branches/pure-cfg/test/iso2d.diderot
 [diderot] / branches / pure-cfg / test / iso2d.diderot

Diff of /branches/pure-cfg/test/iso2d.diderot

revision 1381, Thu Jun 23 19:20:18 2011 UTC revision 1382, Thu Jun 23 20:03:05 2011 UTC
# Line 25  Line 25
25          if (!inside(pos, F) || steps > stepsMax) {          if (!inside(pos, F) || steps > stepsMax) {
26              die;              die;
27          }          }
28            // GLKs recent changes (revision 1329) were made to make the code
29            // a more obvious implementation of Newton-Raphson, and also to create
30            // some obvious and not-so-obvious opportunties for optimization
32          real gmsq = grad • grad;          if (|grad| == 0.0) {    // can't compute step if |∇F|, so have to bail
// If |∇F|=0 we can't compute update; we have to bail
if (gmsq == 0.0) {
33              die;              die;
34          }          }
35          // delta = Newton-Raphson step          vec2 norm = normalize(grad);
36          vec2 delta = -(F(pos) - isoval)*grad/gmsq;          vec2 delta = -((F(pos) - isoval)/|grad|)*norm;  // Newton-Raphson step
37          // We've converged if the update is small enough          if (|delta| < epsilon) {    // we've converged if step is small enough
if (|delta| < epsilon) {
38              stabilize;              stabilize;
39          }          }
40          pos = pos + delta;          pos += delta;
41          steps = steps + 1;          steps += 1;
42      }      }
43  }  }
44

Legend:
 Removed from v.1381 changed lines Added in v.1382