Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorCombinedSlopeAndShoulderAdaption.cs
===================================================================
diff -u -r1341 -r1349
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorCombinedSlopeAndShoulderAdaption.cs (.../DesignCalculatorCombinedSlopeAndShoulderAdaption.cs) (revision 1341)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorCombinedSlopeAndShoulderAdaption.cs (.../DesignCalculatorCombinedSlopeAndShoulderAdaption.cs) (revision 1349)
@@ -55,23 +55,24 @@
///
///
public static void PerformDesignCalculationCombinedSlopeAdaptionAndShoulderAdaption(
- IKernelWrapper kernelWrapper, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput,
- DamKernelInput damKernelInput, DesignScenario designScenario,
+ IKernelWrapper kernelWrapper, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput,
+ DamKernelInput damKernelInput, DesignScenario designScenario,
List calculationMessages, List designCalculations)
{
List designResults;
Location location = damKernelInput.Location;
SoilGeometryProbability subSoilScenario = damKernelInput.SubSoilScenario;
const int maxRedesignIterations = 200;
string resultMessage = "";
- int iterationIndex = -1;
+ int iterationIndex = -1;
designScenario.CalculationResult = CalculationResult.NoRun;
// Create the file with the initial geometry to be used to determine which layers have to be defined as dike embankment material
EmbankmentDesignParameters embankmentDesignParameters;
kernelWrapper.PrepareDesign(kernelDataInput, kernelDataOutput, damKernelInput, iterationIndex, out embankmentDesignParameters);
SurfaceLine2 surfaceLine = designScenario.GetMostRecentSurfaceLine(subSoilScenario.SoilProfile1D, subSoilScenario.StiFileName).FullDeepClone();
-
+ // During the calculation the location.SurfaceLine is adapted; so store a copy to restor it after the calculation
+ SurfaceLine2 orgLocationSurfaceLine = location.SurfaceLine.FullDeepClone();
try
{
iterationIndex = 1;
@@ -92,9 +93,9 @@
else
{
double maxFractionOfDikeHeightForShoulderHeight = location.UseNewMaxHeightShoulderAsFraction ?
- location.NewMaxHeightShoulderAsFraction : defaultMaxFractionOfDikeHeightForShoulderHeight;
- double maxShoulderLevel = DesignCalculatorUtils.CalculateMaximumShoulderLevel(surfaceLine,
- maxFractionOfDikeHeightForShoulderHeight);
+ location.NewMaxHeightShoulderAsFraction : defaultMaxFractionOfDikeHeightForShoulderHeight;
+ double maxShoulderLevel = DesignCalculatorUtils.CalculateMaximumShoulderLevel(surfaceLine,
+ maxFractionOfDikeHeightForShoulderHeight);
while (isRedesignRequired && surfaceLine != null)
{
iterationIndex++;
@@ -107,8 +108,8 @@
// Determine new width and height for shoulder
double shoulderHeight;
double shoulderWidth;
- DesignCalculatorUtils.DetermineNewShoulderWidthAndHeight(location.StabilityShoulderGrowDeltaX,
- location.StabilityShoulderGrowSlope, surfaceLine, limitPointForShoulderDesign, out shoulderHeight, out shoulderWidth);
+ DesignCalculatorUtils.DetermineNewShoulderWidthAndHeight(location.StabilityShoulderGrowDeltaX,
+ location.StabilityShoulderGrowSlope, surfaceLine, limitPointForShoulderDesign, out shoulderHeight, out shoulderWidth);
// Create new shoulder
var surfaceLineShoulderAdapter = new SurfaceLineShoulderAdapter(surfaceLine, location);
@@ -173,6 +174,11 @@
designScenario.SetRedesignedSurfaceLine(subSoilScenario.SoilProfile1D, subSoilScenario.StiFileName, null);
kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, designScenario, errorMessage, out designResults);
}
+ finally
+ {
+ // Restore the original surfaceline
+ location.SurfaceLine = orgLocationSurfaceLine.FullDeepClone();
+ }
designCalculations.AddRange(designResults);
}