Index: DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilProfile2DSurfaceLineHelperTests.cs
===================================================================
diff -u -r7042 -r7049
--- DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilProfile2DSurfaceLineHelperTests.cs (.../SoilProfile2DSurfaceLineHelperTests.cs) (revision 7042)
+++ DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilProfile2DSurfaceLineHelperTests.cs (.../SoilProfile2DSurfaceLineHelperTests.cs) (revision 7049)
@@ -459,7 +459,7 @@
[Test]
[TestCase(35.002, 7)]
- [TestCase(35.001,7)]
+ [TestCase(35.001, 7)]
[TestCase(35.000, 6)]
[TestCase(34.999, 6)]
[TestCase(34.998, 6)]
@@ -479,27 +479,43 @@
// Then
Assert.That(newSoilProfile2D, Is.Not.Null);
Assert.That(newSoilProfile2D.Surfaces, Has.Count.EqualTo(expectedLayerCount));
- if (expectedLayerCount == 6)
+
+ var soil1 = new Soil("Soil1");
+ var soil2 = new Soil("Soil2");
+ var soil3 = new Soil("Soil3");
+ var soil4 = new Soil("Soil4");
+ var soil5 = new Soil("Soil5");
+ SoilLayer2D expectedSurface1 = FactoryForSoilProfiles.CreateRectangularSoilLayer2D(10, 0, -50, -20, newSoilProfile2D, soil1);
+ SoilLayer2D expectedSurface2 = FactoryForSoilProfiles.CreatePentagonSoilLayer2D(new Point2D(-20, 10), new Point2D(0, 10), new Point2D(0, 0), new Point2D(-10, 0), new Point2D(-20, 0), newSoilProfile2D, soil2);
+ SoilLayer2D expectedSurface3 = expectedLayerCount switch
{
- var soil1 = new Soil("Soil1");
- var soil2 = new Soil("Soil2");
- var soil3 = new Soil("Soil3");
- var soil4 = new Soil("Soil4");
- var soil5 = new Soil("Soil5");
- SoilLayer2D expectedSurface1 = FactoryForSoilProfiles.CreateRectangularSoilLayer2D(10, 0, -50, -20, newSoilProfile2D, soil1);
- SoilLayer2D expectedSurface2 = FactoryForSoilProfiles.CreatePentagonSoilLayer2D(new Point2D(-20, 10), new Point2D(0, 10), new Point2D(0, 0), new Point2D(-10, 0), new Point2D(-20, 0), newSoilProfile2D, soil2);
- SoilLayer2D expectedSurface3 = FactoryForSoilProfiles.CreateRectangularSoilLayer2D(10, 0, 0, xEndSurfaceLine, newSoilProfile2D, soil3);
- SoilLayer2D expectedSurface4 = FactoryForSoilProfiles.CreatePentagonSoilLayer2D(new Point2D(-50, 0), new Point2D(-20, 0), new Point2D(-10, 0), new Point2D(-10, -15), new Point2D(-50, -15), newSoilProfile2D, soil4);
- SoilLayer2D expectedSurface5 = FactoryForSoilProfiles.CreatePentagonSoilLayer2D(new Point2D(-10, 0), new Point2D(0, 0), new Point2D(xEndSurfaceLine, 0), new Point2D(xEndSurfaceLine, -15), new Point2D(-10, -15), newSoilProfile2D, soil5);
- SoilLayer2D expectedSurfaceFilling = FactoryForSoilProfiles.CreatePolygoneSoilLayer2D([
- new Point2D(-50, 11), surfaceLine.CharacteristicPoints[1].Point, surfaceLine.CharacteristicPoints[2].Point, surfaceLine.CharacteristicPoints[3].Point, new Point2D(xEndSurfaceLine, 11), new Point2D(xEndSurfaceLine, 10), new Point2D(0, 10), new Point2D(-20, 10), new Point2D(-50, 10)
- ], defaultSoil, newSoilProfile2D);
- CheckSoilProfileContainsSoilLayer(newSoilProfile2D, expectedSurface1);
- CheckSoilProfileContainsSoilLayer(newSoilProfile2D, expectedSurface2);
- CheckSoilProfileContainsSoilLayer(newSoilProfile2D, expectedSurface3);
- CheckSoilProfileContainsSoilLayer(newSoilProfile2D, expectedSurface4);
- CheckSoilProfileContainsSoilLayer(newSoilProfile2D, expectedSurface5);
- CheckSoilProfileContainsSoilLayer(newSoilProfile2D, expectedSurfaceFilling);
+ 6 => FactoryForSoilProfiles.CreateRectangularSoilLayer2D(10, 0, 0, xEndSurfaceLine, newSoilProfile2D, soil3),
+ 7 => FactoryForSoilProfiles.CreatePentagonSoilLayer2D(new Point2D(0, 0), new Point2D(0, 10), new Point2D(xEndSurfaceLine, 10), new Point2D(xEndSurfaceLine, 0), new Point2D(35, 0), newSoilProfile2D, soil3),
+ _ => null
+ };
+
+ SoilLayer2D expectedSurface4 = FactoryForSoilProfiles.CreatePentagonSoilLayer2D(new Point2D(-50, 0), new Point2D(-20, 0), new Point2D(-10, 0), new Point2D(-10, -15), new Point2D(-50, -15), newSoilProfile2D, soil4);
+ SoilLayer2D expectedSurface5 = expectedLayerCount switch
+ {
+ 6 => FactoryForSoilProfiles.CreatePentagonSoilLayer2D(new Point2D(-10, 0), new Point2D(0, 0), new Point2D(xEndSurfaceLine, 0), new Point2D(xEndSurfaceLine, -15), new Point2D(-10, -15), newSoilProfile2D, soil5),
+ 7 => FactoryForSoilProfiles.CreatePentagonSoilLayer2D(new Point2D(-10, 0), new Point2D(0, 0), new Point2D(35, 0), new Point2D(35, -15), new Point2D(-10, -15), newSoilProfile2D, soil5),
+ _ => null
+ };
+ SoilLayer2D expectedSurfaceFilling = FactoryForSoilProfiles.CreatePolygoneSoilLayer2D([
+ new Point2D(-50, 11), surfaceLine.CharacteristicPoints[1].Point, surfaceLine.CharacteristicPoints[2].Point, surfaceLine.CharacteristicPoints[3].Point, new Point2D(xEndSurfaceLine, 11), new Point2D(xEndSurfaceLine, 10), new Point2D(0, 10), new Point2D(-20, 10), new Point2D(-50, 10)
+ ], defaultSoil, newSoilProfile2D);
+ CheckSoilProfileContainsSoilLayer(newSoilProfile2D, expectedSurface1);
+ CheckSoilProfileContainsSoilLayer(newSoilProfile2D, expectedSurface2);
+ CheckSoilProfileContainsSoilLayer(newSoilProfile2D, expectedSurface3);
+ CheckSoilProfileContainsSoilLayer(newSoilProfile2D, expectedSurface4);
+ CheckSoilProfileContainsSoilLayer(newSoilProfile2D, expectedSurface5);
+ CheckSoilProfileContainsSoilLayer(newSoilProfile2D, expectedSurfaceFilling);
+
+ if (expectedLayerCount == 7)
+ {
+ var soil6 = new Soil("Soil6");
+ SoilLayer2D expectedSurface6 = FactoryForSoilProfiles.CreateRectangularSoilLayer2D(0, -15, 35, xEndSurfaceLine, newSoilProfile2D, soil6);
+ CheckSoilProfileContainsSoilLayer(newSoilProfile2D, expectedSurface6);
}
}
@@ -587,6 +603,10 @@
X = xMin[0] + 2,
Z = zMin[0] + 0.2
};
+ if (!expectedSoilLayer.GeometrySurface.OuterLoop.IsPointInLoopArea(gravityPoint))
+ {
+ gravityPoint = Routines2D.ComputeCentroid(expectedSoilLayer.GeometrySurface.OuterLoop.Points);
+ }
for (var i = 0; i < soilProfile2D.Surfaces.Count; i++)
{
Index: DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/Factories/FactoryForSoilProfiles.cs
===================================================================
diff -u -r6917 -r7049
--- DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/Factories/FactoryForSoilProfiles.cs (.../FactoryForSoilProfiles.cs) (revision 6917)
+++ DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/Factories/FactoryForSoilProfiles.cs (.../FactoryForSoilProfiles.cs) (revision 7049)
@@ -545,8 +545,6 @@
public static SoilProfile2D CreateSoilProfile2DWithTwoLayers()
{
const string layerName = "Layer";
- const string topLayerName = "TopLayer";
-
SoilLayer1D soilLayer = CreateSoilLayer(-5, layerName);
var profile = new SoilProfile1D
Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryPoint.cs
===================================================================
diff -u -r6404 -r7049
--- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryPoint.cs (.../GeometryPoint.cs) (revision 6404)
+++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryPoint.cs (.../GeometryPoint.cs) (revision 7049)
@@ -35,7 +35,7 @@
///
/// The precision
///
- public const double Precision = GeometryConstants.Accuracy;
+ public const double Precision = GeometryConstants.Tolerance;
///
/// Initializes a new instance of the class.