Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj =================================================================== diff -u -rf85a7a802a40cf50b055e0464fa6845c6f5c826c -rc4526c07916c8756e52c567f5700e2bcd15b1335 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.csproj) (revision f85a7a802a40cf50b055e0464fa6845c6f5c826c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.csproj) (revision c4526c07916c8756e52c567f5700e2bcd15b1335) @@ -66,7 +66,7 @@ - + Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/SubCalculator/MacroStabilityInwardsKernelWrapperFactory.cs =================================================================== diff -u -rf85a7a802a40cf50b055e0464fa6845c6f5c826c -rc4526c07916c8756e52c567f5700e2bcd15b1335 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/SubCalculator/MacroStabilityInwardsKernelWrapperFactory.cs (.../MacroStabilityInwardsKernelWrapperFactory.cs) (revision f85a7a802a40cf50b055e0464fa6845c6f5c826c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/SubCalculator/MacroStabilityInwardsKernelWrapperFactory.cs (.../MacroStabilityInwardsKernelWrapperFactory.cs) (revision c4526c07916c8756e52c567f5700e2bcd15b1335) @@ -47,7 +47,7 @@ public IUpliftVanKernel CreateUpliftVanKernel() { - return new UpliftVanCalculator(); + return new UpliftVanKernelWrapper(); } } } \ No newline at end of file Fisheye: Tag c4526c07916c8756e52c567f5700e2bcd15b1335 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/SubCalculator/UpliftVanCalculator.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/SubCalculator/UpliftVanKernelWrapper.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/SubCalculator/UpliftVanKernelWrapper.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/SubCalculator/UpliftVanKernelWrapper.cs (revision c4526c07916c8756e52c567f5700e2bcd15b1335) @@ -0,0 +1,216 @@ +// 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.Calculation.Wrapper; +using Deltares.WTIStability.Data.Geo; +using Deltares.WTIStability.IO; +using Deltares.WTIStability.Levenberg; + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.SubCalculator +{ + /// + /// Class that wraps for performing an Uplift Van calculation. + /// + public class UpliftVanKernelWrapper : IUpliftVanKernel + { + private readonly WTIStabilityCalculation wtiStabilityCalculation; + private readonly StabilityModel stabilityModel; + + /// + /// Creates a new instance of . + /// + public UpliftVanKernelWrapper() + { + wtiStabilityCalculation = new WTIStabilityCalculation(); + stabilityModel = new StabilityModel + { + ModelOption = ModelOptions.UpliftVan, + SearchAlgorithm = SearchAlgorithm.Grid, + GridOrientation = GridOrientation.Inwards, + SlipPlaneConstraints = new SlipPlaneConstraints(), + GeneticAlgorithmOptions = new GeneticAlgorithmOptions + { + EliteCount = 2, + PopulationCount = 60, + GenerationCount = 50, + MutationRate = 0.3, + CrossOverScatterFraction = 0, + CrossOverSinglePointFraction = 0.7, + CrossOverDoublePointFraction = 0.3, + MutationJumpFraction = 0, + MutationCreepFraction = 0.9, + MutationInverseFraction = 0.1, + MutationCreepReduction = 0.05, + Seed = 1 + } + }; + } + + public SoilModel SoilModel + { + set + { + stabilityModel.SoilModel = value; + } + } + + public SoilProfile2D SoilProfile + { + set + { + stabilityModel.SoilProfile = value; + } + } + + public StabilityLocation Location + { + set + { + stabilityModel.Location = value; + } + } + + public SurfaceLine2 SurfaceLine + { + set + { + stabilityModel.SurfaceLine2 = value; + } + } + + public bool MoveGrid + { + set + { + stabilityModel.MoveGrid = value; + } + } + + public double MaximumSliceWidth + { + set + { + stabilityModel.MaximumSliceWidth = value; + } + } + + public SlipPlaneUpliftVan SlipPlaneUpliftVan + { + set + { + stabilityModel.SlipPlaneUpliftVan = value; + } + } + + public bool GridAutomaticDetermined + { + set + { + stabilityModel.SlipCircle = new SlipCircle + { + Auto = value + }; + } + } + + public bool CreateZones + { + set + { + stabilityModel.SlipPlaneConstraints.CreateZones = value; + } + } + + public bool AutomaticForbiddenZones + { + set + { + stabilityModel.SlipPlaneConstraints.AutomaticForbiddenZones = value; + } + } + + public double SlipPlaneMinimumDepth + { + set + { + stabilityModel.SlipPlaneConstraints.SlipPlaneMinDepth = value; + } + } + + public double SlipPlaneMinimumLength + { + set + { + stabilityModel.SlipPlaneConstraints.SlipPlaneMinLength = value; + } + } + + public double FactoryOfStability { get; private set; } + + public double ZValue { get; private set; } + + public double ForbiddenZonesXEntryMin { get; private set; } + + public double ForbiddenZonesXEntryMax { get; private set; } + + public bool ForbiddenZonesAutomaticallyCalculated { get; private set; } + + public bool GridAutomaticallyCalculated { get; private set; } + + public SlidingDualCircle SlidingCurveResult { get; private set; } + + public SlipPlaneUpliftVan SlipPlaneResult { get; private set; } + + public void Calculate() + { + wtiStabilityCalculation.InitializeForDeterministic(WTISerializer.Serialize(stabilityModel)); + + string messages = wtiStabilityCalculation.Validate(); + string result = wtiStabilityCalculation.Run(); + + ReadResult(result); + } + + private void ReadResult(string result) + { + StabilityAssessmentCalculationResult convertedResult = WTIDeserializer.DeserializeResult(result); + + if (convertedResult.Messages.Any()) + { + throw new Exception(); + } + + FactoryOfStability = convertedResult.FactorOfSafety; + ZValue = convertedResult.ZValue; + + ForbiddenZonesXEntryMin = convertedResult.XMinEntry; + ForbiddenZonesXEntryMax = convertedResult.XMaxEntry; + ForbiddenZonesAutomaticallyCalculated = convertedResult.AreForbiddenZonesAuto; + GridAutomaticallyCalculated = convertedResult.IsGridAuto; + + SlidingCurveResult = (SlidingDualCircle) convertedResult.Curve; + SlipPlaneResult = convertedResult.SlipPlaneUpliftVan; + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj =================================================================== diff -u -rf85a7a802a40cf50b055e0464fa6845c6f5c826c -rc4526c07916c8756e52c567f5700e2bcd15b1335 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj) (revision f85a7a802a40cf50b055e0464fa6845c6f5c826c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj) (revision c4526c07916c8756e52c567f5700e2bcd15b1335) @@ -78,7 +78,7 @@ - + Fisheye: Tag c4526c07916c8756e52c567f5700e2bcd15b1335 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/SubCalculator/UpliftVanCalculatorTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/SubCalculator/UpliftVanKernelWrapperTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/SubCalculator/UpliftVanKernelWrapperTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/SubCalculator/UpliftVanKernelWrapperTest.cs (revision c4526c07916c8756e52c567f5700e2bcd15b1335) @@ -0,0 +1,40 @@ +// 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 NUnit.Framework; +using Ringtoets.MacroStabilityInwards.KernelWrapper.SubCalculator; + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Test.SubCalculator +{ + [TestFixture] + public class UpliftVanKernelWrapperTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var kernel = new UpliftVanKernelWrapper(); + + // Assert + Assert.IsInstanceOf(kernel); + } + } +} \ No newline at end of file