Mercurial > dive4elements > river
changeset 3643:171db4d5d3cb
FixA: AT export: prevent some numerical problems with steep functions around zero.
flys-artifacts/trunk@5363 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 05 Sep 2012 08:38:12 +0000 |
parents | 83c0735092a3 |
children | fa633f6a5fd9 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixATWriter.java |
diffstat | 2 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Wed Sep 05 08:23:56 2012 +0000 +++ b/flys-artifacts/ChangeLog Wed Sep 05 08:38:12 2012 +0000 @@ -1,3 +1,9 @@ +2012-09-05 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/flys/exports/fixings/FixATWriter.java: + Only goto down to Q = 0.0001 to circumvent some numerial issues + with steep functions around zero. + 2012-09-05 Sascha L. Teichmann <sascha.teichmann@intevation.de> * src/main/java/de/intevation/flys/exports/fixings/FixATWriter.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixATWriter.java Wed Sep 05 08:23:56 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixATWriter.java Wed Sep 05 08:38:12 2012 +0000 @@ -32,6 +32,7 @@ private static final int MAX_ITERATIONS = 10000; private static final double EPSILON = 1e-8; + private static final double MIN_Q = 1e-4; protected Function function; protected Parameters parameters; @@ -166,7 +167,7 @@ double w = lastW - stepWidth; double q = function.value(w); - if (Double.isNaN(q) || q > lastQ || q < 0d) { + if (Double.isNaN(q) || q > lastQ || q < MIN_Q) { if (stepWidth < EPSILON) { break; }