Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Uplift/UpliftLocationDeterminator.cs
===================================================================
diff -u -r5627 -r5773
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Uplift/UpliftLocationDeterminator.cs (.../UpliftLocationDeterminator.cs) (revision 5627)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Uplift/UpliftLocationDeterminator.cs (.../UpliftLocationDeterminator.cs) (revision 5773)
@@ -109,6 +109,7 @@
/// location and upliftfactor
public UpliftLocationAndResult GetUpliftFactorAtPoint(GeometryPoint point)
{
+ const double toleranceAlmostEqual = 1e-09;
SoilProfile1D soilProfileInCurrentPoint = GetSoilProfileBelowPoint(point.X);
var upliftFactorForInBetweenSandLayer = double.MaxValue;
if (soilProfileInCurrentPoint.InBetweenAquiferLayer != null)
@@ -165,7 +166,8 @@
}
}
- if ((upliftFactorForBottomSandLayer == double.MaxValue) && (upliftFactorForInBetweenSandLayer == double.MaxValue))
+ if ((Math.Abs(upliftFactorForBottomSandLayer - double.MaxValue) < toleranceAlmostEqual) &&
+ (Math.Abs(upliftFactorForInBetweenSandLayer - double.MaxValue) < toleranceAlmostEqual))
{
return null;
}
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs
===================================================================
diff -u -r5404 -r5773
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 5404)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 5773)
@@ -1031,6 +1031,7 @@
///
private PlLine CreatePlLineFromGauges(GaugePlLine gaugePlLine, IEnumerable gauges, Location location, Boolean useWaterLevel)
{
+ const double toleranceAlmostEqual = 1e-09;
var plLine = new PlLine();
double? gaugeWaterLevelRiver = null;
@@ -1062,7 +1063,7 @@
Gauge gauge = (gauges.Where(x => x.Name == gaugePlLinePoint.GaugeIDZ && x.Location == location)).FirstOrDefault();
if (gauge != null)
{
- if ((!gauge.Value.HasValue) || (gauge.Value == GaugeMissVal))
+ if (!gauge.Value.HasValue || Math.Abs((double) (gauge.Value - GaugeMissVal)) < toleranceAlmostEqual)
{
throw new PlLinesCreatorException($"Value of gauge {gauge.Name} at location {location.Name} in gauge PL line of type {gaugePlLine.PlLineType.ToString()} is undefined.");
}
@@ -1382,7 +1383,7 @@
}
//Validate if endpoint surface has reached
- if (phreaticLine.Points.Last().X != maxXCoordinateSurface)
+ if (Math.Abs(phreaticLine.Points.Last().X - maxXCoordinateSurface) > GeometryConstants.Tolerance)
{
var endPoint = new PlLinePoint(maxXCoordinateSurface, phreaticLine.Points.Last().Z);
phreaticLine.Points.Add(endPoint);
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineAdapter.cs
===================================================================
diff -u -r4540 -r5773
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineAdapter.cs (.../SurfaceLineAdapter.cs) (revision 4540)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineAdapter.cs (.../SurfaceLineAdapter.cs) (revision 5773)
@@ -144,8 +144,8 @@
{
newSlopeEndPoint = intersectionpoints.First();
// One of the intersection points can be the dike top which should not be replaced
- if (newSlopeEndPoint.X == surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X &&
- newSlopeEndPoint.Z == surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z)
+ if (Math.Abs(newSlopeEndPoint.X - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X) < GeometryConstants.Tolerance &&
+ Math.Abs(newSlopeEndPoint.Z - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z) < GeometryConstants.Tolerance )
{
newSlopeEndPoint = null;
if (intersectionpoints.Count > 1)
@@ -324,7 +324,8 @@
// TODO: #the Following code is not correct; you should also look at the setting of Location.UseNewMinDistanceDikeToeStartDitch
// First determine all coordinates
- if (distanceToNewToe < Location.NewMinDistanceDikeToeStartDitch && distanceToNewToe != ditchDefinition.Value.DistanceFromToe)
+ if (distanceToNewToe < Location.NewMinDistanceDikeToeStartDitch &&
+ Math.Abs(distanceToNewToe - ditchDefinition.Value.DistanceFromToe) > GeometryConstants.Tolerance )
{
// Ditch needs to be moved as it is less then the minimum required distance from the new toe
xDitchDikeSide = dikeToeAtPolder.X +