Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Result/MacroStabilityInwardsSlidingCurveResultCreator.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Result/MacroStabilityInwardsSlidingCurveResultCreator.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Result/MacroStabilityInwardsSlidingCurveResultCreator.cs (revision 16f3a2d1ff6ed7e05949113116c4cfd081f5ddcd)
@@ -0,0 +1,116 @@
+// 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 Core.Common.Base.Geometry;
+using Deltares.WTIStability;
+
+namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Result
+{
+ ///
+ /// Creates instances.
+ ///
+ public static class MacroStabilityInwardsSlidingCurveResultCreator
+ {
+ ///
+ /// Creates a based on the information
+ /// given in the .
+ ///
+ /// The output to create the result for.
+ /// A new with information
+ /// taken from the
+ /// Thrown when
+ /// is null.
+ public static MacroStabilityInwardsSlidingCurveResult Create(SlidingDualCircle slidingCurve)
+ {
+ if (slidingCurve == null)
+ {
+ throw new ArgumentNullException(nameof(slidingCurve));
+ }
+
+ MacroStabilityInwardsSlidingCircleResult leftCircle = slidingCurve.LeftCircleIsActive ? CreateActiveCircle(slidingCurve) : CreatePassiveCircle(slidingCurve);
+ MacroStabilityInwardsSlidingCircleResult rightCircle = slidingCurve.LeftCircleIsActive ? CreatePassiveCircle(slidingCurve) : CreateActiveCircle(slidingCurve);
+
+ return new MacroStabilityInwardsSlidingCurveResult(leftCircle, rightCircle, CreateSlices(slidingCurve.Slices),
+ slidingCurve.HorizontalForce0, slidingCurve.HorizontalForce);
+ }
+
+ private static MacroStabilityInwardsSlidingCircleResult CreateActiveCircle(SlidingDualCircle slidingCurve)
+ {
+ return new MacroStabilityInwardsSlidingCircleResult(new Point2D(slidingCurve.ActiveCircle.X, slidingCurve.ActiveCircle.Z),
+ slidingCurve.ActiveRadius, true, slidingCurve.ActiveForce0, slidingCurve.ActiveForce,
+ slidingCurve.DrivingMomentActive, slidingCurve.ResistingMomentActive);
+ }
+
+ private static MacroStabilityInwardsSlidingCircleResult CreatePassiveCircle(SlidingDualCircle slidingCurve)
+ {
+ return new MacroStabilityInwardsSlidingCircleResult(new Point2D(slidingCurve.PassiveCircle.X, slidingCurve.PassiveCircle.Z),
+ slidingCurve.PassiveRadius, false, slidingCurve.PassiveForce0, slidingCurve.PassiveForce,
+ slidingCurve.DrivingMomentPassive, slidingCurve.ResistingMomentPassive);
+ }
+
+ private static IEnumerable CreateSlices(IEnumerable slidingCurveSlices)
+ {
+ return slidingCurveSlices.Select(
+ slice =>
+ new MacroStabilityInwardsSliceResult(
+ new Point2D(slice.TopLeftX, slice.TopLeftZ),
+ new Point2D(slice.TopRightX, slice.TopRightZ),
+ new Point2D(slice.BottomLeftX, slice.BottomLeftZ),
+ new Point2D(slice.BottomRightX, slice.BottomRightZ),
+ new MacroStabilityInwardsSliceResult.ConstructionProperties
+ {
+ Cohesion = slice.Cohesion,
+ FrictionAngle = slice.Phi,
+ CriticalPressure = slice.PGrens,
+ OverConsolidationRatio = slice.OCR,
+ Pop = slice.POP,
+ DegreeOfConsolidationPorePressureSoil = slice.DegreeofConsolidationPorePressure,
+ DegreeOfConsolidationPorePressureLoad = slice.PorePressureDueToDegreeOfConsolidationLoad,
+ Dilatancy = slice.Dilatancy,
+ ExternalLoad = slice.ExternalLoad,
+ HydrostaticPorePressure = slice.HydrostaticPorePressure,
+ LeftForce = slice.LeftForce,
+ LeftForceAngle = slice.LeftForceAngle,
+ LeftForceY = slice.LeftForceY,
+ RightForce = slice.RightForce,
+ RightForceAngle = slice.RightForceAngle,
+ RightForceY = slice.RightForceY,
+ LoadStress = slice.LoadStress,
+ NormalStress = slice.NormalStress,
+ PorePressure = slice.PoreOnSurface,
+ HorizontalPorePressure = slice.HPoreOnSurface,
+ VerticalPorePressure = slice.VPoreOnSurface,
+ PiezometricPorePressure = slice.PiezometricPorePressure,
+ EffectiveStress = slice.EffectiveStress,
+ EffectiveStressDaily = slice.EffectiveStressDaily,
+ ExcessPorePressure = slice.ExcessPorePressure,
+ ShearStress = slice.ShearStress,
+ SoilStress = slice.SoilStress,
+ TotalPorePressure = slice.TotalPorePressure,
+ TotalStress = slice.TotalStress,
+ Weight = slice.Weight
+ })).ToArray();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj
===================================================================
diff -u -rec61461326a925d109c7a58600a8fe3ee4c2b31c -r16f3a2d1ff6ed7e05949113116c4cfd081f5ddcd
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.csproj) (revision ec61461326a925d109c7a58600a8fe3ee4c2b31c)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.csproj) (revision 16f3a2d1ff6ed7e05949113116c4cfd081f5ddcd)
@@ -57,6 +57,7 @@
+
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Result/MacroStabilityInwardsSlidingCurveResultCreatorTest.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Result/MacroStabilityInwardsSlidingCurveResultCreatorTest.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Result/MacroStabilityInwardsSlidingCurveResultCreatorTest.cs (revision 16f3a2d1ff6ed7e05949113116c4cfd081f5ddcd)
@@ -0,0 +1,272 @@
+// 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.Linq;
+using Deltares.WTIStability;
+using Deltares.WTIStability.Data.Geo;
+using NUnit.Framework;
+using Ringtoets.MacroStabilityInwards.KernelWrapper.Result;
+using Point2D = Core.Common.Base.Geometry.Point2D;
+
+namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Test.Result
+{
+ [TestFixture]
+ public class MacroStabilityInwardsSlidingCurveResultCreatorTest
+ {
+ [Test]
+ public void Create_SlidingCurveNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => MacroStabilityInwardsSlidingCurveResultCreator.Create(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("slidingCurve", exception.ParamName);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Create_WithSlidingCurve_ReturnSlidingCurveResult(bool leftCircleIsActive)
+ {
+ // Setup
+ var random = new Random(21);
+ double activeCircleX = random.Next();
+ double activeCircleZ = random.Next();
+
+ double activeCircleIteratedForce = random.Next();
+ double activeCircleNonIteratedForce = random.Next();
+ double activeCircleRadius = random.Next();
+ double activeCircleDrivingMoment = random.Next();
+ double activeCircleResistingMoment = random.Next();
+
+ double passiveCircleX = random.Next();
+ double passiveCircleZ = random.Next();
+ double passiveCircleIteratedForce = random.Next();
+ double passiveCircleNonIteratedForce = random.Next();
+ double passiveCircleRadius = random.Next();
+ double passiveCircleDrivingMoment = random.Next();
+ double passiveCircleResistingMoment = random.Next();
+
+ double iteratedHorizontalForce = random.Next();
+ double nonIteratedHorizontalForce = random.Next();
+
+ var slidingCurve = new SlidingDualCircle
+ {
+ LeftCircleIsActive = leftCircleIsActive,
+ ActiveCircle = new GeometryPoint(activeCircleX, activeCircleZ),
+ ActiveForce = activeCircleIteratedForce,
+ ActiveForce0 = activeCircleNonIteratedForce,
+ ActiveRadius = activeCircleRadius,
+ DrivingMomentActive = activeCircleDrivingMoment,
+ ResistingMomentActive = activeCircleResistingMoment,
+ PassiveCircle = new GeometryPoint(passiveCircleX, passiveCircleZ),
+ PassiveForce = passiveCircleIteratedForce,
+ PassiveForce0 = passiveCircleNonIteratedForce,
+ PassiveRadius = passiveCircleRadius,
+ DrivingMomentPassive = passiveCircleDrivingMoment,
+ ResistingMomentPassive = passiveCircleResistingMoment,
+ HorizontalForce = iteratedHorizontalForce,
+ HorizontalForce0 = nonIteratedHorizontalForce
+ };
+
+ // Call
+ MacroStabilityInwardsSlidingCurveResult result = MacroStabilityInwardsSlidingCurveResultCreator.Create(slidingCurve);
+
+ // Assert
+ AssertActiveCircle(leftCircleIsActive ? result.LeftCircle : result.RightCircle,
+ activeCircleX, activeCircleZ, activeCircleIteratedForce,
+ activeCircleNonIteratedForce, activeCircleRadius,
+ activeCircleDrivingMoment, activeCircleResistingMoment);
+
+ AssertPassiveCircle(leftCircleIsActive ? result.RightCircle : result.LeftCircle,
+ passiveCircleX, passiveCircleZ, passiveCircleIteratedForce,
+ passiveCircleNonIteratedForce, passiveCircleRadius,
+ passiveCircleDrivingMoment, passiveCircleResistingMoment);
+
+ Assert.AreEqual(iteratedHorizontalForce, result.IteratedHorizontalForce);
+ Assert.AreEqual(nonIteratedHorizontalForce, result.NonIteratedHorizontalForce);
+ }
+
+ [Test]
+ public void Create_SlidingCurveWithSlices_ReturnSlidingCurveResult()
+ {
+ // Setup
+ var random = new Random(21);
+ double topLeftX = random.NextDouble();
+ double topLeftZ = random.NextDouble();
+ double topRightX = random.NextDouble();
+ double topRightZ = random.NextDouble();
+ double bottomLeftX = random.NextDouble();
+ double bottomLeftZ = random.NextDouble();
+ double bottomRightX = random.NextDouble();
+ double bottomRightZ = random.NextDouble();
+ double cohesion = random.NextDouble();
+ double frictionAngle = random.NextDouble();
+ double criticalPressure = random.NextDouble();
+ double overConsolidationRatio = random.NextDouble();
+ double pop = random.NextDouble();
+ double degreeOfConsolidationPorePressureSoil = random.NextDouble();
+ double degreeOfConsolidationPorePressureLoad = random.NextDouble();
+ double dilatancy = random.NextDouble();
+ double externalLoad = random.NextDouble();
+ double hydrostaticPorePressure = random.NextDouble();
+ double leftForce = random.NextDouble();
+ double leftForceAngle = random.NextDouble();
+ double leftForceY = random.NextDouble();
+ double rightForce = random.NextDouble();
+ double rightForceAngle = random.NextDouble();
+ double rightForceY = random.NextDouble();
+ double loadStress = random.NextDouble();
+ double normalStress = random.NextDouble();
+ double porePressure = random.NextDouble();
+ double horizontalPorePressure = random.NextDouble();
+ double verticalPorePressure = random.NextDouble();
+ double piezometricPorePressure = random.NextDouble();
+ double effectiveStress = random.NextDouble();
+ double effectiveStressDaily = random.NextDouble();
+ double excessPorePressure = random.NextDouble();
+ double shearStress = random.NextDouble();
+ double soilStress = random.NextDouble();
+ double totalPorePressure = random.NextDouble();
+ double totalStress = random.NextDouble();
+ double weight = random.NextDouble();
+
+ var slidingCurve = new SlidingDualCircle
+ {
+ Slices =
+ {
+ new Slice
+ {
+ TopLeftX = topLeftX,
+ TopLeftZ = topLeftZ,
+ TopRightX = topRightX,
+ TopRightZ = topRightZ,
+ BottomLeftX = bottomLeftX,
+ BottomLeftZ = bottomLeftZ,
+ BottomRightX = bottomRightX,
+ BottomRightZ = bottomRightZ,
+ Cohesion = cohesion,
+ Phi = frictionAngle,
+ PGrens = criticalPressure,
+ OCR = overConsolidationRatio,
+ POP = pop,
+ DegreeofConsolidationPorePressure = degreeOfConsolidationPorePressureSoil,
+ PorePressureDueToDegreeOfConsolidationLoad = degreeOfConsolidationPorePressureLoad,
+ Dilatancy = dilatancy,
+ ExternalLoad = externalLoad,
+ HydrostaticPorePressure = hydrostaticPorePressure,
+ LeftForce = leftForce,
+ LeftForceAngle = leftForceAngle,
+ LeftForceY = leftForceY,
+ RightForce = rightForce,
+ RightForceAngle = rightForceAngle,
+ RightForceY = rightForceY,
+ LoadStress = loadStress,
+ NormalStress = normalStress,
+ PoreOnSurface = porePressure,
+ HPoreOnSurface = horizontalPorePressure,
+ VPoreOnSurface = verticalPorePressure,
+ PiezometricPorePressure = piezometricPorePressure,
+ EffectiveStress = effectiveStress,
+ EffectiveStressDaily = effectiveStressDaily,
+ ExcessPorePressure = excessPorePressure,
+ ShearStress = shearStress,
+ SoilStress = soilStress,
+ TotalPorePressure = totalPorePressure,
+ TotalStress = totalStress,
+ Weight = weight
+ }
+ }
+ };
+
+ // Call
+ MacroStabilityInwardsSlidingCurveResult result = MacroStabilityInwardsSlidingCurveResultCreator.Create(slidingCurve);
+
+ // Assert
+ Assert.AreEqual(1, result.Slices.Count());
+
+ MacroStabilityInwardsSliceResult slice = result.Slices.First();
+ Assert.AreEqual(new Point2D(topLeftX, topLeftZ), slice.TopLeftPoint);
+ Assert.AreEqual(new Point2D(topRightX, topRightZ), slice.TopRightPoint);
+ Assert.AreEqual(new Point2D(bottomLeftX, bottomLeftZ), slice.BottomLeftPoint);
+ Assert.AreEqual(new Point2D(bottomRightX, bottomRightZ), slice.BottomRightPoint);
+
+ Assert.AreEqual(cohesion, slice.Cohesion);
+ Assert.AreEqual(frictionAngle, slice.FrictionAngle);
+ Assert.AreEqual(criticalPressure, slice.CriticalPressure);
+ Assert.AreEqual(overConsolidationRatio, slice.OverConsolidationRatio);
+ Assert.AreEqual(pop, slice.Pop);
+ Assert.AreEqual(degreeOfConsolidationPorePressureSoil, slice.DegreeOfConsolidationPorePressureSoil);
+ Assert.AreEqual(degreeOfConsolidationPorePressureLoad, slice.DegreeOfConsolidationPorePressureLoad);
+ Assert.AreEqual(dilatancy, slice.Dilatancy);
+ Assert.AreEqual(externalLoad, slice.ExternalLoad);
+ Assert.AreEqual(hydrostaticPorePressure, slice.HydrostaticPorePressure);
+ Assert.AreEqual(leftForce, slice.LeftForce);
+ Assert.AreEqual(leftForceAngle, slice.LeftForceAngle);
+ Assert.AreEqual(leftForceY, slice.LeftForceY);
+ Assert.AreEqual(rightForce, slice.RightForce);
+ Assert.AreEqual(rightForceAngle, slice.RightForceAngle);
+ Assert.AreEqual(rightForceY, slice.RightForceY);
+ Assert.AreEqual(loadStress, slice.LoadStress);
+ Assert.AreEqual(normalStress, slice.NormalStress);
+ Assert.AreEqual(porePressure, slice.PorePressure);
+ Assert.AreEqual(horizontalPorePressure, slice.HorizontalPorePressure);
+ Assert.AreEqual(verticalPorePressure, slice.VerticalPorePressure);
+ Assert.AreEqual(piezometricPorePressure, slice.PiezometricPorePressure);
+ Assert.AreEqual(effectiveStress, slice.EffectiveStress);
+ Assert.AreEqual(effectiveStressDaily, slice.EffectiveStressDaily);
+ Assert.AreEqual(excessPorePressure, slice.ExcessPorePressure);
+ Assert.AreEqual(shearStress, slice.ShearStress);
+ Assert.AreEqual(soilStress, slice.SoilStress);
+ Assert.AreEqual(totalPorePressure, slice.TotalPorePressure);
+ Assert.AreEqual(totalStress, slice.TotalStress);
+ Assert.AreEqual(weight, slice.Weight);
+ }
+
+ private static void AssertActiveCircle(MacroStabilityInwardsSlidingCircleResult circle, double x, double z, double iteratedForce,
+ double nonIteratedForce, double radius, double drivingMoment, double resistingMoment)
+ {
+ Assert.IsTrue(circle.IsActive);
+ AssertCircle(circle, x, z, iteratedForce, nonIteratedForce, radius, drivingMoment, resistingMoment);
+ }
+
+ private static void AssertPassiveCircle(MacroStabilityInwardsSlidingCircleResult circle, double x, double z, double iteratedForce,
+ double nonIteratedForce, double radius, double drivingMoment, double resistingMoment)
+ {
+ Assert.IsFalse(circle.IsActive);
+ AssertCircle(circle, x, z, iteratedForce, nonIteratedForce, radius, drivingMoment, resistingMoment);
+ }
+
+ private static void AssertCircle(MacroStabilityInwardsSlidingCircleResult circle, double x, double z, double iteratedForce,
+ double nonIteratedForce, double radius, double drivingMoment, double resistingMoment)
+ {
+ Assert.AreEqual(x, circle.Center.X);
+ Assert.AreEqual(z, circle.Center.Y);
+ Assert.AreEqual(iteratedForce, circle.IteratedForce);
+ Assert.AreEqual(nonIteratedForce, circle.NonIteratedForce);
+ Assert.AreEqual(radius, circle.Radius);
+ Assert.AreEqual(drivingMoment, circle.DrivingMoment);
+ Assert.AreEqual(resistingMoment, circle.ResistingMoment);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj
===================================================================
diff -u -ra1fa1538918813373bcc864f0bce092bf28fd0ce -r16f3a2d1ff6ed7e05949113116c4cfd081f5ddcd
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj) (revision a1fa1538918813373bcc864f0bce092bf28fd0ce)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj) (revision 16f3a2d1ff6ed7e05949113116c4cfd081f5ddcd)
@@ -72,6 +72,7 @@
+