Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthUtils.java @ 9503:83e6acdf8fc6
Fixed: no rounding during calculations (Meilenstein-2 2.9)
author | mschaefer |
---|---|
date | Fri, 28 Sep 2018 10:11:06 +0200 |
parents | 8ae7137b67d7 |
children |
comparison
equal
deleted
inserted
replaced
9502:69a7edd7d1e1 | 9503:83e6acdf8fc6 |
---|---|
8 * documentation coming with Dive4Elements River for details. | 8 * documentation coming with Dive4Elements River for details. |
9 */ | 9 */ |
10 package org.dive4elements.river.artifacts.sinfo.flowdepth; | 10 package org.dive4elements.river.artifacts.sinfo.flowdepth; |
11 | 11 |
12 import org.dive4elements.river.artifacts.model.Calculation; | 12 import org.dive4elements.river.artifacts.model.Calculation; |
13 import org.dive4elements.river.utils.Formatter; | |
14 | 13 |
15 /** | 14 /** |
16 * @author Gernot Belger | 15 * @author Gernot Belger |
17 */ | 16 */ |
18 public final class FlowDepthUtils { | 17 public final class FlowDepthUtils { |
56 /* >= 1998 */ | 55 /* >= 1998 */ |
57 return 3; | 56 return 3; |
58 } | 57 } |
59 | 58 |
60 /** | 59 /** |
61 * Calculates a flow depth, rounded to the active scale | 60 * Calculates a flow depth |
62 */ | 61 */ |
63 public static double calcFlowDepth(final double wst, final double bedHeight) { | 62 public static double calcFlowDepth(final double wst, final double bedHeight) { |
64 if (Double.isNaN(wst) || Double.isInfinite(wst) || Double.isNaN(bedHeight) || Double.isInfinite(bedHeight)) | 63 if (Double.isNaN(wst) || Double.isInfinite(wst) || Double.isNaN(bedHeight) || Double.isInfinite(bedHeight)) |
65 return Math.max(wst - bedHeight, 0.0); | 64 return Math.max(wst - bedHeight, 0.0); |
66 return Math.max(Formatter.roundFlowDepth(wst).subtract(Formatter.roundFlowDepth(bedHeight)).doubleValue(), 0.0); | 65 return Math.max(wst - bedHeight, 0.0); |
67 } | 66 } |
68 } | 67 } |