Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs =================================================================== diff -u -r2633 -r2634 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs (.../DesignCalculator.cs) (revision 2633) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs (.../DesignCalculator.cs) (revision 2634) @@ -273,31 +273,44 @@ DesignScenario designScenario, List calculationMessages, List designCalculations) { - if (damKernelInput.Location.RedesignDikeShoulder) + // 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 { - // Redesign the surfaceline with shoulder and or slope adaption - switch (kernelWrapper.GetDesignStrategy(damKernelInput)) + if (damKernelInput.Location.RedesignDikeShoulder) { - 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; + // 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; + } } ///