Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIoTests.cs =================================================================== diff -u -r4898 -r5070 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIoTests.cs (.../MacroStabilityIoTests.cs) (revision 4898) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIoTests.cs (.../MacroStabilityIoTests.cs) (revision 5070) @@ -524,4 +524,29 @@ return slices; } + + [Test] + // ToDo: Add XEntry etc. MWDAM-2255 + public void GivenDamKernelInput_WhenTransferSlipPlaneConstraints_ThenSlipPlaneConstraintsAreTransferred() + { + // Given + var damKernelInput = new DamKernelInput + { + Location = new Location() + { + SurfaceLine = new SurfaceLine2 {}, + StabilityOptions = new StabilityOptions + { + MinimalCircleDepth = 1.5 + } + } + }; + var macroStabilityInput = new MacroStabilityInput + { + }; + // When + FillMacroStabilityWrapperInputFromEngine.TransferSlipPlaneConstraints(damKernelInput.Location, macroStabilityInput.StabilityModel.SlipPlaneConstraints); + // Then + Assert.That(macroStabilityInput.StabilityModel.SlipPlaneConstraints.SlipPlaneMinDepth, Is.EqualTo(1.5)); + } } \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityWrapperInputFromEngine.cs =================================================================== diff -u -r5062 -r5070 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityWrapperInputFromEngine.cs (.../FillMacroStabilityWrapperInputFromEngine.cs) (revision 5062) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityWrapperInputFromEngine.cs (.../FillMacroStabilityWrapperInputFromEngine.cs) (revision 5070) @@ -26,7 +26,6 @@ using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Geotechnics; -using Deltares.DamEngine.Data.Standard; using Deltares.MacroStability.CSharpWrapper; using Deltares.MacroStability.CSharpWrapper.Input; using Deltares.MacroStability.CSharpWrapper.Water; @@ -87,7 +86,7 @@ ConstructionStage lastStage = macroStabilityInput.StabilityModel.ConstructionStages.Last(); TransferStabilityModelProperties(mStabParameters, macroStabilityInput.StabilityModel); - TransferSlipPlaneConstraints(damKernelInput.Location.StabilityOptions, macroStabilityInput.StabilityModel.SlipPlaneConstraints); + TransferSlipPlaneConstraints(damKernelInput.Location, macroStabilityInput.StabilityModel.SlipPlaneConstraints); TransferSoils(damKernelInput.Location.SoilList, macroStabilityInput.StabilityModel.Soils, lastStage.FixedSoilStresses); lastStage.SoilProfile = new SoilProfile(); @@ -148,19 +147,19 @@ kernelStabilityInput.Orientation = ConversionHelper.ConvertToGridOrientation(mStabParameters.GridPosition); } - private void TransferSlipPlaneConstraints(StabilityOptions stabilityOptions, SlipPlaneConstraints slipPlaneConstraints) + protected internal static void TransferSlipPlaneConstraints(Location location, SlipPlaneConstraints slipPlaneConstraints) { -// Work in progress MWDAM-2255 - // slipPlaneConstraints.SlipPlaneMinDepth = stabilityOptions.MinimalCircleDepth?? 0.0; - // if ((stabilityOptions.StabilityZoneType == MStabZonesType.ForbiddenZone) && stabilityOptions.ForbiddenZoneFactor.HasValue) - // { - // var xKruinBuitenTalud = -20.0; - // slipPlaneConstraints.XEntryMin = xKruinBuitenTalud; - // var xKruinBinnenTalud = -10.0; - // var xTeenDijkBinnenwaarts = 10.0; - // var factor = stabilityOptions.ForbiddenZoneFactor.Value; - // slipPlaneConstraints.XEntryMax = (xTeenDijkBinnenwaarts * factor) + ((1 - factor) * xKruinBinnenTalud); - // } + slipPlaneConstraints.SlipPlaneMinDepth = location.StabilityOptions.MinimalCircleDepth?? 0.0; + if ((location.StabilityOptions.StabilityZoneType == MStabZonesType.ForbiddenZone) && + location.StabilityOptions.ForbiddenZoneFactor.HasValue) + { + CharacteristicPointSet characteristicPoints = location.SurfaceLine.CharacteristicPoints; + slipPlaneConstraints.XEntryMin = characteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).X; + double xDikeTopAtPolder = characteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X; + double xDikeToeAtPolder = characteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X; + double factor = location.StabilityOptions.ForbiddenZoneFactor.Value; + slipPlaneConstraints.XEntryMax = (xDikeToeAtPolder * factor) + ((1 - factor) * xDikeTopAtPolder); + } } private void CreateDefaultBeeSwarmOptions(StabilityInput kernelStabilityInput)