Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/SlipPlaneUpliftVanCreator.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/SlipPlaneUpliftVanCreator.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/SlipPlaneUpliftVanCreator.cs (revision 177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff) @@ -0,0 +1,79 @@ +// 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; +using Ringtoets.MacroStabilityInwards.Primitives; + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Creators +{ + /// + /// Creates instances which are required by the . + /// + internal static class SlipPlaneUpliftVanCreator + { + /// + /// Creates a based on the given , + /// which can be used in the . + /// + /// The to get the information from. + /// A new with the given information from . + /// Thrown when is null. + public static SlipPlaneUpliftVan Create(MacroStabilityInwardsCalculatorInput input) + { + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + return new SlipPlaneUpliftVan + { + SlipPlaneLeftGrid = CreateGrid(input.LeftGrid), + SlipPlaneRightGrid = CreateGrid(input.RightGrid), + SlipPlaneTangentLine = CreateTangentline(input) + }; + } + + private static SlipCircleTangentLine CreateTangentline(MacroStabilityInwardsCalculatorInput input) + { + return new SlipCircleTangentLine + { + AutomaticAtBoundaries = input.TangentLineAutomaticAtBoundaries, + TangentLineZTop = input.TangentLineZTop, + TangentLineZBottom = input.TangentLineZBottom, + TangentLineNumber = 1 + }; + } + + private static SlipCircleGrid CreateGrid(MacroStabilityInwardsGrid grid) + { + return new SlipCircleGrid + { + GridXLeft = grid.XLeft, + GridXRight = grid.XRight, + GridZTop = grid.ZTop, + GridZBottom = grid.ZBottom, + GridXNumber = grid.NumberOfHorizontalPoints, + GridZNumber = grid.NumberOfVerticalPoints + }; + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/SoilProfileCreator.cs =================================================================== diff -u -r3678f8db830d30b1d0e6518ea3b71ce5465e93fe -r177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/SoilProfileCreator.cs (.../SoilProfileCreator.cs) (revision 3678f8db830d30b1d0e6518ea3b71ce5465e93fe) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/SoilProfileCreator.cs (.../SoilProfileCreator.cs) (revision 177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff) @@ -23,7 +23,6 @@ using System.Collections.Generic; using System.Linq; using Deltares.WTIStability.Data.Geo; -using Ringtoets.MacroStabilityInwards.Primitives; using Ringtoets.MacroStabilityInwards.Primitives.MacroStabilityInwardsSoilUnderSurfaceLine; namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Creators Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculator.cs =================================================================== diff -u -reb77464397a17cc0a006933b6d9bfeb5cfba3d66 -r177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculator.cs (.../MacroStabilityInwardsCalculator.cs) (revision eb77464397a17cc0a006933b6d9bfeb5cfba3d66) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculator.cs (.../MacroStabilityInwardsCalculator.cs) (revision 177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff) @@ -22,6 +22,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Deltares.WTIStability; using Deltares.WTIStability.Data.Geo; using Deltares.WTIStability.Data.Standard; using Ringtoets.MacroStabilityInwards.KernelWrapper.Creators; @@ -103,6 +104,8 @@ calculator.SoilProfile = SoilProfileCreator.Create(layersWithSoils); calculator.Location = StabilityLocationCreator.Create(input); calculator.SurfaceLine = SurfaceLineCreator.Create(input.SurfaceLine); + calculator.SlipPlaneUpliftVan = SlipPlaneUpliftVanCreator.Create(input); + calculator.GridAutomaticDetermined = input.GridAutomaticDetermined; return calculator; } Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj =================================================================== diff -u -rb8a87d12087e3af75515ecbf7ddf5004108e826d -r177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.csproj) (revision b8a87d12087e3af75515ecbf7ddf5004108e826d) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.csproj) (revision 177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff) @@ -43,6 +43,7 @@ Properties\GlobalAssembly.cs + Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/SubCalculator/IUpliftVanCalculator.cs =================================================================== diff -u -rb8a87d12087e3af75515ecbf7ddf5004108e826d -r177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/SubCalculator/IUpliftVanCalculator.cs (.../IUpliftVanCalculator.cs) (revision b8a87d12087e3af75515ecbf7ddf5004108e826d) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/SubCalculator/IUpliftVanCalculator.cs (.../IUpliftVanCalculator.cs) (revision 177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff) @@ -63,5 +63,15 @@ /// Sets the maximum slice width. /// double MaximumSliceWidth { set; } + + /// + /// Sets the slip plane uplift van. + /// + SlipPlaneUpliftVan SlipPlaneUpliftVan { set; } + + /// + /// sets whether the grid is automatic determined or not. + /// + bool GridAutomaticDetermined { set; } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/SubCalculator/UpliftVanCalculator.cs =================================================================== diff -u -r3678f8db830d30b1d0e6518ea3b71ce5465e93fe -r177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/SubCalculator/UpliftVanCalculator.cs (.../UpliftVanCalculator.cs) (revision 3678f8db830d30b1d0e6518ea3b71ce5465e93fe) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/SubCalculator/UpliftVanCalculator.cs (.../UpliftVanCalculator.cs) (revision 177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff) @@ -86,7 +86,6 @@ } } - public bool MoveGrid { set @@ -103,6 +102,25 @@ } } + public SlipPlaneUpliftVan SlipPlaneUpliftVan + { + set + { + calculatorInput.SlipPlaneUpliftVan = value; + } + } + + public bool GridAutomaticDetermined + { + set + { + calculatorInput.SlipCircle = new SlipCircle + { + Auto = value + }; + } + } + public void Calculate() { try Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/SlipPlaneUpliftVanCreatorTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/SlipPlaneUpliftVanCreatorTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/SlipPlaneUpliftVanCreatorTest.cs (revision 177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff) @@ -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 Core.Common.Base.Data; +using Core.Common.TestUtil; +using Deltares.WTIStability; +using NUnit.Framework; +using Ringtoets.MacroStabilityInwards.KernelWrapper.Creators; +using Ringtoets.MacroStabilityInwards.Primitives; + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Test.Creators +{ + [TestFixture] + public class SlipPlaneUpliftVanCreatorTest + { + [Test] + public void Create_InputNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => SlipPlaneUpliftVanCreator.Create(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("input", exception.ParamName); + } + + [Test] + public void Create_WithInput_ReturnSlipPlaneUpliftVan() + { + // Setup + var random = new Random(21); + var leftGridXLeft = new RoundedDouble(2, random.NextDouble()); + var leftGridXRight = new RoundedDouble(2, random.NextDouble()); + var leftGridZTop = new RoundedDouble(2, random.NextDouble()); + var leftGridZBottom = new RoundedDouble(2, random.NextDouble()); + int leftGridXNumber = random.Next(); + int leftGridZNumber = random.Next(); + var rightGridXLeft = new RoundedDouble(2, random.NextDouble()); + var rightGridXRight = new RoundedDouble(2, random.NextDouble()); + var rightGridZTop = new RoundedDouble(2, random.NextDouble()); + var rightGridZBottom = new RoundedDouble(2, random.NextDouble()); + int rightGridXNumber = random.Next(); + int rightGridZNumber = random.Next(); + + double tangentLineZTop = random.NextDouble(); + double tangentLineZBottom = random.NextDouble(); + bool tangentLineAutomaticAtBoundaries = random.NextBoolean(); + + var input = new MacroStabilityInwardsCalculatorInput(new MacroStabilityInwardsCalculatorInput.ConstructionProperties + { + LeftGrid = new MacroStabilityInwardsGrid + { + XLeft = leftGridXLeft, + XRight = leftGridXRight, + ZTop = leftGridZTop, + ZBottom = leftGridZBottom, + NumberOfHorizontalPoints = leftGridXNumber, + NumberOfVerticalPoints = leftGridZNumber + }, + RightGrid = new MacroStabilityInwardsGrid + { + XLeft = rightGridXLeft, + XRight = rightGridXRight, + ZTop = rightGridZTop, + ZBottom = rightGridZBottom, + NumberOfHorizontalPoints = rightGridXNumber, + NumberOfVerticalPoints = rightGridZNumber + }, + TangentLineZTop = tangentLineZTop, + TangentLineZBottom = tangentLineZBottom, + TangentLineAutomaticAtBoundaries = tangentLineAutomaticAtBoundaries + }); + + // Call + SlipPlaneUpliftVan slipPlaneUpliftVan = SlipPlaneUpliftVanCreator.Create(input); + + // Assert + Assert.AreEqual(leftGridXLeft, slipPlaneUpliftVan.SlipPlaneLeftGrid.GridXLeft); + Assert.AreEqual(leftGridXRight, slipPlaneUpliftVan.SlipPlaneLeftGrid.GridXRight); + Assert.AreEqual(leftGridZTop, slipPlaneUpliftVan.SlipPlaneLeftGrid.GridZTop); + Assert.AreEqual(leftGridZBottom, slipPlaneUpliftVan.SlipPlaneLeftGrid.GridZBottom); + Assert.AreEqual(leftGridXNumber, slipPlaneUpliftVan.SlipPlaneLeftGrid.GridXNumber); + Assert.AreEqual(leftGridZNumber, slipPlaneUpliftVan.SlipPlaneLeftGrid.GridZNumber); + Assert.AreEqual(rightGridXLeft, slipPlaneUpliftVan.SlipPlaneRightGrid.GridXLeft); + Assert.AreEqual(rightGridXRight, slipPlaneUpliftVan.SlipPlaneRightGrid.GridXRight); + Assert.AreEqual(rightGridZTop, slipPlaneUpliftVan.SlipPlaneRightGrid.GridZTop); + Assert.AreEqual(rightGridZBottom, slipPlaneUpliftVan.SlipPlaneRightGrid.GridZBottom); + Assert.AreEqual(rightGridXNumber, slipPlaneUpliftVan.SlipPlaneRightGrid.GridXNumber); + Assert.AreEqual(rightGridZNumber, slipPlaneUpliftVan.SlipPlaneRightGrid.GridZNumber); + + Assert.AreEqual(tangentLineZTop, slipPlaneUpliftVan.SlipPlaneTangentLine.TangentLineZTop); + Assert.AreEqual(tangentLineZBottom, slipPlaneUpliftVan.SlipPlaneTangentLine.TangentLineZBottom); + Assert.AreEqual(tangentLineAutomaticAtBoundaries, slipPlaneUpliftVan.SlipPlaneTangentLine.AutomaticAtBoundaries); + Assert.AreEqual(1, slipPlaneUpliftVan.SlipPlaneTangentLine.TangentLineNumber); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorTest.cs =================================================================== diff -u -r378756fb27984abc7c2fdf13650b5b1700f94917 -r177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorTest.cs (.../MacroStabilityInwardsCalculatorTest.cs) (revision 378756fb27984abc7c2fdf13650b5b1700f94917) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorTest.cs (.../MacroStabilityInwardsCalculatorTest.cs) (revision 177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff) @@ -96,7 +96,9 @@ { AssessmentLevel = random.NextDouble(), SurfaceLine = surfaceLine, - SoilProfile = CreateValidSoilProfile(surfaceLine) + SoilProfile = CreateValidSoilProfile(surfaceLine), + LeftGrid = new MacroStabilityInwardsGrid(), + RightGrid = new MacroStabilityInwardsGrid() }; } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj =================================================================== diff -u -rb8a87d12087e3af75515ecbf7ddf5004108e826d -r177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj) (revision b8a87d12087e3af75515ecbf7ddf5004108e826d) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj) (revision 177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff) @@ -60,6 +60,7 @@ Properties\GlobalAssembly.cs + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/SubCalculator/UpliftVanCalculatorStub.cs =================================================================== diff -u -rb8a87d12087e3af75515ecbf7ddf5004108e826d -r177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/SubCalculator/UpliftVanCalculatorStub.cs (.../UpliftVanCalculatorStub.cs) (revision b8a87d12087e3af75515ecbf7ddf5004108e826d) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/SubCalculator/UpliftVanCalculatorStub.cs (.../UpliftVanCalculatorStub.cs) (revision 177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff) @@ -47,6 +47,10 @@ public SurfaceLine2 SurfaceLine { get; set; } + public SlipPlaneUpliftVan SlipPlaneUpliftVan { get; set; } + + public bool GridAutomaticDetermined { get; set; } + public void Calculate() { Calculated = true;