Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/PipingSellmeijer4ForcesTests.cs =================================================================== diff -u -r1364 -r1366 --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/PipingSellmeijer4ForcesTests.cs (.../PipingSellmeijer4ForcesTests.cs) (revision 1364) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/PipingSellmeijer4ForcesTests.cs (.../PipingSellmeijer4ForcesTests.cs) (revision 1366) @@ -98,9 +98,9 @@ // dike length = 66.986 Assert.AreEqual(66.986, redesignedSurfaceLine.GetDikeLength(), tolerance); - // ShoulderLength = X_Kruin binnenberm - X_Insteek binnenberm = 65.01 - 29.01 = 36.0 + // ShoulderWidth = X_Kruin binnenberm - X_Insteek binnenberm = 65.01 - 29.01 = 36.0 // Read from PipingSellmeijer4Forces_Piping_CharacteristicPoints.csv by export surfacelines in Release - Assert.AreEqual(36.0, redesignedSurfaceLine.DetermineShoulderLength(), tolerance); + Assert.AreEqual(36.0, redesignedSurfaceLine.DetermineShoulderWidth(), tolerance); Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3MinUplift, tolerance); Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3HeadAdjusted, tolerance); @@ -132,7 +132,7 @@ Assert.AreEqual(0.582, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftFactor, tolerance); } - [Test, Category("Work_In_Progress")] + [Test] public void CanPerformSellmeijer4ForcesDesignWithAdaptionWithHeightPipingVoorbeeld1() { // Based on ".\data\DamEngineTestProjects\PipingVoorbeeld1\PipingSellmeijer4Forces.damx" @@ -148,15 +148,17 @@ DamProjectData actualDamProjectData = FillDamFromXmlOutput.CreateDamProjectData(null, output); SurfaceLine2 redesignedSurfaceLine = actualDamProjectData.DesignCalculations[0].PipingDesignResults.RedesignedSurfaceLine; - // The following 2 line are the only differences with CanPerformSellmeijer4ForcesDesignWithAdaptionPipingVoorbeeld1() + // The following test are different from CanPerformSellmeijer4ForcesDesignWithAdaptionPipingVoorbeeld1() Assert.AreEqual(4.5, redesignedSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).Z, tolerance); Assert.AreEqual(4.5, redesignedSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z, tolerance); + // ShoulderWidth = X_Kruin binnenberm - X_Insteek binnenberm = 65.01 - 32.01 = 33.0 + // Read from PipingSellmeijer4Forces_Piping_CharacteristicPoints.csv by export surfacelines in Release + Assert.AreEqual(33.0, redesignedSurfaceLine.DetermineShoulderWidth(), tolerance); // The following test are the same as for CanPerformSellmeijer4ForcesDesignWithAdaptionPipingVoorbeeld1() Assert.AreEqual(true, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.IsUplift); Assert.AreEqual(1.995, redesignedSurfaceLine.DetermineShoulderHeight(), tolerance); Assert.AreEqual(66.986, redesignedSurfaceLine.GetDikeLength(), tolerance); - Assert.AreEqual(36.0, redesignedSurfaceLine.DetermineShoulderLength(), tolerance); Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3MinUplift, tolerance); Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3HeadAdjusted, tolerance); Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3LocationXMinUplift, tolerance); Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs =================================================================== diff -u -r1351 -r1366 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs (.../DesignCalculator.cs) (revision 1351) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs (.../DesignCalculator.cs) (revision 1366) @@ -152,27 +152,51 @@ DesignScenario designScenario, List calculationMessages, List designCalculations) { - switch (kernelWrapper.GetDesignStrategy(damKernelInput)) + // During the design calculation the location.SurfaceLine is adapted; so store a copy to restore it after the calculation + Location location = damKernelInput.Location; + SurfaceLine2 orgLocationSurfaceLine = location.SurfaceLine.FullDeepClone(); + try { - case DesignStrategy.ShoulderPerPoint: - DesignCalculatorShoulderPerPoint.PerformDesignCalculationShoulderPerPoint( - kernelWrapper, kernelDataInput, kernelDataOutput, - damKernelInput, designScenario, calculationMessages, - designCalculations); - break; - case DesignStrategy.NoDesignPossible: - throw new NotImplementedException("No design is possible for this failure mechanism"); - case DesignStrategy.SlopeAdaptionBeforeShoulderAdaption: - DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.PerformDesignCalculationFirstSlopeAdaptionThenShoulderAdaption( - kernelWrapper, kernelDataInput, kernelDataOutput, damKernelInput, designScenario, - calculationMessages, designCalculations); - break; - case DesignStrategy.OptimizedSlopeAndShoulderAdaption: - DesignCalculatorCombinedSlopeAndShoulderAdaption.PerformDesignCalculationCombinedSlopeAdaptionAndShoulderAdaption( - kernelWrapper, kernelDataInput, kernelDataOutput, damKernelInput, designScenario, - calculationMessages, designCalculations); - break; + if (damKernelInput.Location.RedesignDikeHeight) + { + // Redesign the surfaceline to the desired Dike Tabel Height + var surfaceLineHeightAdapter = new SurfaceLineHeightAdapter(location.SurfaceLine, location); + SurfaceLine2 adaptedSurfaceLine = surfaceLineHeightAdapter.ConstructNewSurfaceLine(designScenario.DikeTableHeight ?? location.SurfaceLine.GetDefaultDikeTableHeight() ?? 0); + location.SurfaceLine = adaptedSurfaceLine; + } + if (damKernelInput.Location.RedesignDikeShoulder) + { + // Redesign the surfaceline with shoulder and or slope adaption + switch (kernelWrapper.GetDesignStrategy(damKernelInput)) + { + case DesignStrategy.ShoulderPerPoint: + DesignCalculatorShoulderPerPoint.PerformDesignCalculationShoulderPerPoint( + kernelWrapper, kernelDataInput, kernelDataOutput, + damKernelInput, designScenario, calculationMessages, + designCalculations); + break; + case DesignStrategy.NoDesignPossible: + throw new NotImplementedException("No design is possible for this failure mechanism"); + case DesignStrategy.SlopeAdaptionBeforeShoulderAdaption: + DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.PerformDesignCalculationFirstSlopeAdaptionThenShoulderAdaption( + kernelWrapper, kernelDataInput, kernelDataOutput, damKernelInput, designScenario, + calculationMessages, designCalculations); + break; + case DesignStrategy.OptimizedSlopeAndShoulderAdaption: + DesignCalculatorCombinedSlopeAndShoulderAdaption.PerformDesignCalculationCombinedSlopeAdaptionAndShoulderAdaption( + kernelWrapper, kernelDataInput, kernelDataOutput, damKernelInput, designScenario, + calculationMessages, designCalculations); + break; + } + } } + finally + { + // Restore the original surfaceline + location.SurfaceLine = orgLocationSurfaceLine.FullDeepClone(); + + } + } ///