Fisheye: Tag c62200ea10d37435621c8f3387c78dc911b6b7e2 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/MacroStabilityInwardsSoilCreator.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c62200ea10d37435621c8f3387c78dc911b6b7e2 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/MacroStabilityInwardsSoilModelCreator.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c62200ea10d37435621c8f3387c78dc911b6b7e2 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/MacroStabilityInwardsSoilProfileCreator.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/SoilCreator.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/SoilCreator.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/SoilCreator.cs (revision c62200ea10d37435621c8f3387c78dc911b6b7e2)
@@ -0,0 +1,104 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.ComponentModel;
+using System.Linq;
+using Deltares.WTIStability.Data.Geo;
+using Ringtoets.MacroStabilityInwards.Primitives;
+
+namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Creators
+{
+ ///
+ /// Creates instances which are required by the .
+ ///
+ internal static class SoilCreator
+ {
+ ///
+ /// Creates a based on information contained in the profile ,
+ /// which can be used in the .
+ ///
+ /// The from
+ /// which to take the information.
+ /// A new with information taken from the .
+ /// Thrown when is null.
+ /// Thrown when
+ /// is an invalid value.
+ /// Thrown when
+ /// is a valid value but unsupported.
+ public static Soil[] Create(MacroStabilityInwardsSoilProfileUnderSurfaceLine profile)
+ {
+ if (profile == null)
+ {
+ throw new ArgumentNullException(nameof(profile));
+ }
+
+ return profile.LayersUnderSurfaceLine.Select(l =>
+ {
+ MacroStabilityInwardsSoilLayerPropertiesUnderSurfaceLine properties = l.Properties;
+
+ return new Soil(properties.MaterialName)
+ {
+ UsePop = properties.UsePop,
+ ShearStrengthModel = ConvertShearStrengthModel(properties.ShearStrengthModel),
+ AbovePhreaticLevel = properties.AbovePhreaticLevelDesignVariable,
+ BelowPhreaticLevel = properties.BelowPhreaticLevelDesignVariable,
+ Cohesion = properties.CohesionDesignVariable,
+ FrictionAngle = properties.FrictionAngleDesignVariable,
+ RatioCuPc = properties.ShearStrengthRatioDesignVariable,
+ StrengthIncreaseExponent = properties.StrengthIncreaseExponentDesignVariable,
+ PoP = properties.PopDesignVariable
+ };
+ }).ToArray();
+ }
+
+ ///
+ /// Converts a to a .
+ ///
+ /// The to convert.
+ /// A based on the information of .
+ /// Thrown when
+ /// is an invalid value.
+ /// Thrown when
+ /// is a valid value but unsupported.
+ private static ShearStrengthModel ConvertShearStrengthModel(MacroStabilityInwardsShearStrengthModel shearStrengthModel)
+ {
+ if (!Enum.IsDefined(typeof(MacroStabilityInwardsShearStrengthModel), shearStrengthModel))
+ {
+ throw new InvalidEnumArgumentException(nameof(shearStrengthModel),
+ (int) shearStrengthModel,
+ typeof(MacroStabilityInwardsShearStrengthModel));
+ }
+
+ switch (shearStrengthModel)
+ {
+ case MacroStabilityInwardsShearStrengthModel.SuCalculated:
+ return ShearStrengthModel.CuCalculated;
+ case MacroStabilityInwardsShearStrengthModel.CPhi:
+ return ShearStrengthModel.CPhi;
+ case MacroStabilityInwardsShearStrengthModel.CPhiOrSuCalculated:
+ return ShearStrengthModel.CPhiOrCuCalculated;
+ default:
+ throw new NotSupportedException();
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/SoilModelCreator.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/SoilModelCreator.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/SoilModelCreator.cs (revision c62200ea10d37435621c8f3387c78dc911b6b7e2)
@@ -0,0 +1,52 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Deltares.WTIStability.Data.Geo;
+using Deltares.WTIStability.Data.Standard;
+
+namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Creators
+{
+ ///
+ /// Creates instances which are required by the .
+ ///
+ internal static class SoilModelCreator
+ {
+ ///
+ /// Creates a with the given
+ /// which can be used in the .
+ ///
+ /// The array of to use in the .
+ /// A new with the .
+ /// Thrown when is null.
+ public static SoilModel Create(Soil[] soils)
+ {
+ if (soils == null)
+ {
+ throw new ArgumentNullException(nameof(soils));
+ }
+
+ var soilModel = new SoilModel();
+ soilModel.Soils.AddRange(soils);
+ return soilModel;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/SoilProfileCreator.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/SoilProfileCreator.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/SoilProfileCreator.cs (revision c62200ea10d37435621c8f3387c78dc911b6b7e2)
@@ -0,0 +1,155 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using Deltares.WTIStability.Data.Geo;
+using Ringtoets.MacroStabilityInwards.Primitives;
+
+namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Creators
+{
+ ///
+ /// Creates instances which are required by the .
+ ///
+ internal static class SoilProfileCreator
+ {
+ private static GeometryData geometryData;
+
+ ///
+ /// Creates a with the given
+ /// which can be used in the .
+ ///
+ /// The data to use in the .
+ /// A new with the .
+ /// Thrown when is null.
+ public static SoilProfile2D Create(IDictionary layersWithSoils)
+ {
+ if (layersWithSoils == null)
+ {
+ throw new ArgumentNullException(nameof(layersWithSoils));
+ }
+
+ geometryData = new GeometryData();
+
+ var profile = new SoilProfile2D();
+
+ foreach (KeyValuePair layerWithSoil in layersWithSoils)
+ {
+ profile.Surfaces.Add(new SoilLayer2D
+ {
+ IsAquifer = layerWithSoil.Key.Properties.IsAquifer,
+ Soil = layerWithSoil.Value,
+ GeometrySurface = CreateGeometrySurface(layerWithSoil.Key)
+ });
+ }
+
+ profile.Geometry = geometryData;
+
+ return profile;
+ }
+
+ private static GeometrySurface CreateGeometrySurface(MacroStabilityInwardsSoilLayerUnderSurfaceLine layer)
+ {
+ var outerLoop = new GeometryLoop();
+ GeometryCurve[] curves = ToCurveList(layer.OuterRing);
+
+ geometryData.Curves.AddRange(curves);
+ outerLoop.CurveList.AddRange(curves);
+
+ geometryData.Loops.Add(outerLoop);
+
+ var innerloops = new List();
+ foreach (Core.Common.Base.Geometry.Point2D[] layerHole in layer.Holes)
+ {
+ GeometryCurve[] holeCurves = ToCurveList(layerHole);
+ geometryData.Curves.AddRange(holeCurves);
+ innerloops.Add(CurvesToLoop(holeCurves));
+ }
+
+ geometryData.Loops.AddRange(innerloops);
+
+ var surface = new GeometrySurface
+ {
+ OuterLoop = outerLoop
+ };
+ surface.InnerLoops.AddRange(innerloops);
+
+ geometryData.Surfaces.Add(surface);
+
+ return surface;
+ }
+
+ private static GeometryLoop CurvesToLoop(GeometryCurve[] curves)
+ {
+ var loop = new GeometryLoop();
+ loop.CurveList.AddRange(curves);
+ return loop;
+ }
+
+ private static GeometryCurve[] ToCurveList(Core.Common.Base.Geometry.Point2D[] points)
+ {
+ var geometryPoints = (List)geometryData.Points;
+
+ var curves = new List();
+
+ var firstPoint = new Point2D(points[0].X, points[0].Y);
+ Point2D lastPoint = null;
+
+ for (var i = 0; i < points.Length - 1; i++)
+ {
+ Point2D headPoint;
+
+ if (i == 0)
+ {
+ headPoint = firstPoint;
+ geometryPoints.Add(headPoint);
+ }
+ else
+ {
+ headPoint = lastPoint;
+ }
+
+ var endPoint = new Point2D(points[i + 1].X, points[i + 1].Y);
+
+ geometryPoints.Add(endPoint);
+
+ curves.Add(new GeometryCurve
+ {
+ HeadPoint = headPoint,
+ EndPoint = endPoint,
+ });
+
+ lastPoint = endPoint;
+ }
+
+ if (lastPoint != null && (Math.Abs(lastPoint.X - firstPoint.X) > 1e-6 || Math.Abs(lastPoint.Z - firstPoint.Z) > 1e-6))
+ {
+ curves.Add(new GeometryCurve
+ {
+ HeadPoint = lastPoint,
+ EndPoint = firstPoint
+ });
+ }
+
+ return curves.ToArray();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculator.cs
===================================================================
diff -u -re0472e1b583bd29a675a1dff5ff95e0ffdd0bb82 -rc62200ea10d37435621c8f3387c78dc911b6b7e2
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculator.cs (.../MacroStabilityInwardsCalculator.cs) (revision e0472e1b583bd29a675a1dff5ff95e0ffdd0bb82)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculator.cs (.../MacroStabilityInwardsCalculator.cs) (revision c62200ea10d37435621c8f3387c78dc911b6b7e2)
@@ -85,8 +85,8 @@
private IUpliftVanCalculator CreateUpliftVanCalculator()
{
IUpliftVanCalculator calculator = factory.CreateUpliftVanCalculator();
- Soil[] soils = MacroStabilityInwardsSoilCreator.Create(input.SoilProfile);
- calculator.SoilModel = MacroStabilityInwardsSoilModelCreator.Create(soils);
+ Soil[] soils = SoilCreator.Create(input.SoilProfile);
+ calculator.SoilModel = SoilModelCreator.Create(soils);
Dictionary layersWithSoils =
input.SoilProfile.LayersUnderSurfaceLine
@@ -96,7 +96,7 @@
})
.ToDictionary(x => x.layer, x => x.soil);
- calculator.SoilProfile = MacroStabilityInwardsSoilProfileCreator.Create(layersWithSoils);
+ calculator.SoilProfile = SoilProfileCreator.Create(layersWithSoils);
return calculator;
}
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj
===================================================================
diff -u -r2e4a7f40ff810375ec45120f7e3ff41b417dea67 -rc62200ea10d37435621c8f3387c78dc911b6b7e2
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.csproj) (revision 2e4a7f40ff810375ec45120f7e3ff41b417dea67)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.csproj) (revision c62200ea10d37435621c8f3387c78dc911b6b7e2)
@@ -43,13 +43,13 @@
Properties\GlobalAssembly.cs
-
+
-
-
+
+
Fisheye: Tag c62200ea10d37435621c8f3387c78dc911b6b7e2 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/MacroStabilityInwardsSoilCreatorTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c62200ea10d37435621c8f3387c78dc911b6b7e2 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/MacroStabilityInwardsSoilModelCreatorTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c62200ea10d37435621c8f3387c78dc911b6b7e2 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/MacroStabilityInwardsSoilProfileCreatorTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/SoilCreatorTest.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/SoilCreatorTest.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/SoilCreatorTest.cs (revision c62200ea10d37435621c8f3387c78dc911b6b7e2)
@@ -0,0 +1,152 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.ComponentModel;
+using System.Linq;
+using Core.Common.TestUtil;
+using Deltares.WTIStability.Data.Geo;
+using NUnit.Framework;
+using Ringtoets.MacroStabilityInwards.KernelWrapper.Creators;
+using Ringtoets.MacroStabilityInwards.Primitives;
+using Point2D = Core.Common.Base.Geometry.Point2D;
+
+namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Test.Creators
+{
+ [TestFixture]
+ public class SoilCreatorTest
+ {
+ [Test]
+ public void Create_ProfileNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => SoilCreator.Create(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("profile", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_ProfileWithLayers_ReturnsProfileWithLayers()
+ {
+ // Setup
+ var profile = new MacroStabilityInwardsSoilProfileUnderSurfaceLine(new[]
+ {
+ new MacroStabilityInwardsSoilLayerUnderSurfaceLine(new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1)
+ }, new TestMacroStabilityInwardsSoilLayerPropertiesUnderSurfaceLine(
+ new MacroStabilityInwardsSoilLayerPropertiesUnderSurfaceLine.ConstructionProperties
+ {
+ UsePop = true,
+ ShearStrengthModel = MacroStabilityInwardsShearStrengthModel.CPhi,
+ MaterialName = "Sand",
+ })),
+ new MacroStabilityInwardsSoilLayerUnderSurfaceLine(new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1)
+ }, new TestMacroStabilityInwardsSoilLayerPropertiesUnderSurfaceLine(
+ new MacroStabilityInwardsSoilLayerPropertiesUnderSurfaceLine.ConstructionProperties
+ {
+ UsePop = true,
+ ShearStrengthModel = MacroStabilityInwardsShearStrengthModel.CPhiOrSuCalculated,
+ MaterialName = "Clay"
+ })),
+ new MacroStabilityInwardsSoilLayerUnderSurfaceLine(new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1)
+ }, new TestMacroStabilityInwardsSoilLayerPropertiesUnderSurfaceLine(
+ new MacroStabilityInwardsSoilLayerPropertiesUnderSurfaceLine.ConstructionProperties
+ {
+ UsePop = true,
+ ShearStrengthModel = MacroStabilityInwardsShearStrengthModel.SuCalculated,
+ MaterialName = "Grass"
+ }))
+ });
+
+ // Call
+ Soil[] soils = SoilCreator.Create(profile);
+
+ // Assert
+ Assert.AreEqual(3, soils.Length);
+
+ CollectionAssert.AreEqual(profile.LayersUnderSurfaceLine.Select(l => l.Properties.UsePop), soils.Select(s => s.UsePop));
+ CollectionAssert.AreEqual(profile.LayersUnderSurfaceLine.Select(l => l.Properties.MaterialName), soils.Select(s => s.Name));
+ CollectionAssert.AreEqual(new[]
+ {
+ ShearStrengthModel.CPhi,
+ ShearStrengthModel.CPhiOrCuCalculated,
+ ShearStrengthModel.CuCalculated
+ }, soils.Select(s => s.ShearStrengthModel));
+ CollectionAssert.AreEqual(profile.LayersUnderSurfaceLine.Select(l => l.Properties.AbovePhreaticLevelDesignVariable.Value), soils.Select(s => s.AbovePhreaticLevel));
+ CollectionAssert.AreEqual(profile.LayersUnderSurfaceLine.Select(l => l.Properties.BelowPhreaticLevelDesignVariable.Value), soils.Select(s => s.BelowPhreaticLevel));
+ CollectionAssert.AreEqual(profile.LayersUnderSurfaceLine.Select(l => l.Properties.CohesionDesignVariable.Value), soils.Select(s => s.Cohesion));
+ CollectionAssert.AreEqual(profile.LayersUnderSurfaceLine.Select(l => l.Properties.FrictionAngleDesignVariable.Value), soils.Select(s => s.FrictionAngle));
+ CollectionAssert.AreEqual(profile.LayersUnderSurfaceLine.Select(l => l.Properties.ShearStrengthRatioDesignVariable.Value), soils.Select(s => s.RatioCuPc));
+ CollectionAssert.AreEqual(profile.LayersUnderSurfaceLine.Select(l => l.Properties.StrengthIncreaseExponentDesignVariable.Value), soils.Select(s => s.StrengthIncreaseExponent));
+ CollectionAssert.AreEqual(profile.LayersUnderSurfaceLine.Select(l => l.Properties.PopDesignVariable.Value), soils.Select(s => s.PoP));
+ }
+
+ [Test]
+ public void Create_InvalidShearStrengthModel_ThrowInvalidEnumArgumentException()
+ {
+ // Setup
+ var profile = new MacroStabilityInwardsSoilProfileUnderSurfaceLine(new[]
+ {
+ new MacroStabilityInwardsSoilLayerUnderSurfaceLine(new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1)
+ }, new MacroStabilityInwardsSoilLayerPropertiesUnderSurfaceLine(new MacroStabilityInwardsSoilLayerPropertiesUnderSurfaceLine.ConstructionProperties
+ {
+ ShearStrengthModel = (MacroStabilityInwardsShearStrengthModel) 99
+ }))
+ });
+
+ // Call
+ TestDelegate test = () => SoilCreator.Create(profile);
+
+ // Assert
+ string message = $"The value of argument 'shearStrengthModel' ({99}) is invalid for Enum type '{typeof(MacroStabilityInwardsShearStrengthModel).Name}'.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, message);
+ }
+
+ private class TestMacroStabilityInwardsSoilLayerPropertiesUnderSurfaceLine : MacroStabilityInwardsSoilLayerPropertiesUnderSurfaceLine
+ {
+ public TestMacroStabilityInwardsSoilLayerPropertiesUnderSurfaceLine(ConstructionProperties properties)
+ : base(properties)
+ {
+ var random = new Random(21);
+ AbovePhreaticLevelDesignVariable = random.NextRoundedDouble();
+ BelowPhreaticLevelDesignVariable = random.NextRoundedDouble();
+ CohesionDesignVariable = random.NextRoundedDouble();
+ FrictionAngleDesignVariable = random.NextRoundedDouble();
+ ShearStrengthRatioDesignVariable = random.NextRoundedDouble();
+ StrengthIncreaseExponentDesignVariable = random.NextRoundedDouble();
+ PopDesignVariable = random.NextRoundedDouble();
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/SoilModelCreatorTest.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/SoilModelCreatorTest.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/SoilModelCreatorTest.cs (revision c62200ea10d37435621c8f3387c78dc911b6b7e2)
@@ -0,0 +1,60 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Deltares.WTIStability.Data.Geo;
+using NUnit.Framework;
+using Ringtoets.MacroStabilityInwards.KernelWrapper.Creators;
+
+namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Test.Creators
+{
+ [TestFixture]
+ public class SoilModelCreatorTest
+ {
+ [Test]
+ public void Create_SoilsNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => SoilModelCreator.Create(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("soils", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_WithSoils_ReturnSoilModelWithSoils()
+ {
+ // Setup
+ var soils = new[]
+ {
+ new Soil("soil 1"),
+ new Soil("soil 2")
+ };
+
+ // Call
+ SoilModel soilModel = SoilModelCreator.Create(soils);
+
+ // Assert
+ CollectionAssert.AreEqual(soils, soilModel.Soils);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/SoilProfileCreatorTest.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/SoilProfileCreatorTest.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/SoilProfileCreatorTest.cs (revision c62200ea10d37435621c8f3387c78dc911b6b7e2)
@@ -0,0 +1,181 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Deltares.WTIStability.Data.Geo;
+using NUnit.Framework;
+using Ringtoets.MacroStabilityInwards.KernelWrapper.Creators;
+using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil;
+using Ringtoets.MacroStabilityInwards.Primitives;
+using Point2D = Core.Common.Base.Geometry.Point2D;
+using WTIStabilityPoint2D = Deltares.WTIStability.Data.Geo.Point2D;
+
+namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Test.Creators
+{
+ [TestFixture]
+ public class SoilProfileCreatorTest
+ {
+ [Test]
+ public void Create_DictionaryNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => SoilProfileCreator.Create(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("layersWithSoils", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_WithAllData_ReturnSoilProfile2D()
+ {
+ // Setup
+ var outerRing = new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(10, 10),
+ new Point2D(9, 9)
+ };
+ var holes = new[]
+ {
+ new[]
+ {
+ new Point2D(2, 2),
+ new Point2D(4, 4),
+ new Point2D(2.5, 2.5)
+ },
+ new[]
+ {
+ new Point2D(3, 3),
+ new Point2D(5, 5),
+ new Point2D(3, 3)
+ }
+ };
+
+ var layer = new MacroStabilityInwardsSoilLayerUnderSurfaceLine(
+ outerRing, holes,
+ new MacroStabilityInwardsSoilLayerPropertiesUnderSurfaceLine(
+ new MacroStabilityInwardsSoilLayerPropertiesUnderSurfaceLine.ConstructionProperties
+ {
+ IsAquifer = true
+ }));
+
+ var soil = new Soil();
+
+ // Call
+ SoilProfile2D profile = SoilProfileCreator.Create(new Dictionary
+ {
+ {
+ layer, soil
+ }
+ });
+
+ // Assert
+ Assert.AreEqual(1, profile.Surfaces.Count);
+ SoilLayer2D surface = profile.Surfaces.First();
+ Assert.AreSame(soil, surface.Soil);
+ Assert.AreEqual(layer.Properties.IsAquifer, surface.IsAquifer);
+
+ var point1 = new WTIStabilityPoint2D(0, 0);
+ var point2 = new WTIStabilityPoint2D(10, 10);
+ var point3 = new WTIStabilityPoint2D(9, 9);
+ var point4 = new WTIStabilityPoint2D(2, 2);
+ var point5 = new WTIStabilityPoint2D(4, 4);
+ var point6 = new WTIStabilityPoint2D(2.5, 2.5);
+ var point7 = new WTIStabilityPoint2D(3, 3);
+ var point8 = new WTIStabilityPoint2D(5, 5);
+ var point9 = new WTIStabilityPoint2D(3, 3);
+ var outerLoopCurve1 = new GeometryCurve(point1, point2);
+ var outerLoopCurve2 = new GeometryCurve(point2, point3);
+ var outerLoopCurve3 = new GeometryCurve(point3, point1);
+ var innerLoop1Curve1 = new GeometryCurve(point4, point5);
+ var innerLoop1Curve2 = new GeometryCurve(point5, point6);
+ var innerLoop1Curve3 = new GeometryCurve(point6, point4);
+ var innerLoop2Curve1 = new GeometryCurve(point7, point8);
+ var innerLoop2Curve2 = new GeometryCurve(point8, point9);
+ var expectedOuterLoop = new GeometryLoop
+ {
+ CurveList =
+ {
+ outerLoopCurve1,
+ outerLoopCurve2,
+ outerLoopCurve3
+ }
+ };
+ var expectedInnerLoop1 = new GeometryLoop
+ {
+ CurveList =
+ {
+ innerLoop1Curve1,
+ innerLoop1Curve2,
+ innerLoop1Curve3
+ }
+ };
+ var expectedInnerLoop2 = new GeometryLoop
+ {
+ CurveList =
+ {
+ innerLoop2Curve1,
+ innerLoop2Curve2
+ }
+ };
+
+ CollectionAssert.AreEqual(new[]
+ {
+ point1,
+ point2,
+ point3,
+ point4,
+ point5,
+ point6,
+ point7,
+ point8,
+ point9
+ }, profile.Geometry.Points, new WTIStabilityPoint2DComparer());
+ CollectionAssert.AreEqual(new[]
+ {
+ outerLoopCurve1,
+ outerLoopCurve2,
+ outerLoopCurve3,
+ innerLoop1Curve1,
+ innerLoop1Curve2,
+ innerLoop1Curve3,
+ innerLoop2Curve1,
+ innerLoop2Curve2
+ }, profile.Geometry.Curves, new WTIStabilityGeometryCurveComparer());
+ CollectionAssert.AreEqual(new[]
+ {
+ expectedOuterLoop,
+ expectedInnerLoop1,
+ expectedInnerLoop2
+ }, profile.Geometry.Loops, new WTIStabilityGeometryLoopComparer());
+
+ CollectionAssert.AreEqual(expectedOuterLoop.CurveList, surface.GeometrySurface.OuterLoop.CurveList, new WTIStabilityGeometryCurveComparer());
+ CollectionAssert.AreEqual(new[]
+ {
+ expectedInnerLoop1,
+ expectedInnerLoop2
+ }, surface.GeometrySurface.InnerLoops, new WTIStabilityGeometryLoopComparer());
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj
===================================================================
diff -u -r2e4a7f40ff810375ec45120f7e3ff41b417dea67 -rc62200ea10d37435621c8f3387c78dc911b6b7e2
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj) (revision 2e4a7f40ff810375ec45120f7e3ff41b417dea67)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj) (revision c62200ea10d37435621c8f3387c78dc911b6b7e2)
@@ -60,13 +60,13 @@
Properties\GlobalAssembly.cs
-
+
-
-
+
+