Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Design/DesignScenario.cs =================================================================== diff -u -r877 -r1349 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Design/DesignScenario.cs (.../DesignScenario.cs) (revision 877) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Design/DesignScenario.cs (.../DesignScenario.cs) (revision 1349) @@ -75,7 +75,7 @@ private static readonly Expression> ExpressionHeadPl4 = x => x.HeadPl4; private static readonly Expression> ExpressionWaterHeightDecimeringsHoogte = x => x.WaterHeightDecimeringsHoogte; private static readonly Expression> ExpressionMaxWaterLevel = x => x.MaxWaterLevel; - + #endregion private CalculationResult calculationResult = CalculationResult.NoRun; @@ -88,7 +88,7 @@ private Dictionary safetyFactorsPiping; private Dictionary redesignedSurfaceLines; private Dictionary resultMessages; - + private string locationScenarioId; private double riverLevel; private double? riverLevelLow; @@ -116,7 +116,7 @@ { get { return calculationResults; } } - + /// /// Constructor /// @@ -143,7 +143,7 @@ { Errors = new StringCollection(); } - + /// /// Clears the results /// @@ -155,7 +155,7 @@ safetyFactorsPiping = new Dictionary(); resultMessages = new Dictionary(); redesignedSurfaceLines = new Dictionary(); - calculationResults.Clear(); + calculationResults.Clear(); } /// @@ -164,15 +164,15 @@ /// /// The location scenario identifier. /// - public string LocationScenarioID + public string LocationScenarioID { get { return locationScenarioId; } set { - locationScenarioId = value; + locationScenarioId = value; } } @@ -194,7 +194,7 @@ } set { - riverLevel = value; + riverLevel = value; } } @@ -232,7 +232,7 @@ } set { - dikeTableHeight = value; + dikeTableHeight = value; } } @@ -248,7 +248,7 @@ get { return ModelFactors.RequiredSafetyFactorStabilityInnerSlope; } set { - ModelFactors.RequiredSafetyFactorStabilityInnerSlope = value; + ModelFactors.RequiredSafetyFactorStabilityInnerSlope = value; } } @@ -264,7 +264,7 @@ get { return ModelFactors.RequiredSafetyFactorStabilityOuterSlope; } set { - ModelFactors.RequiredSafetyFactorStabilityOuterSlope = value; + ModelFactors.RequiredSafetyFactorStabilityOuterSlope = value; } } @@ -280,7 +280,7 @@ get { return ModelFactors.RequiredSafetyFactorPiping; } set { - ModelFactors.RequiredSafetyFactorPiping = value; + ModelFactors.RequiredSafetyFactorPiping = value; } } @@ -296,7 +296,7 @@ get { return ModelFactors.UpliftCriterionPiping; } set { - ModelFactors.UpliftCriterionPiping = value; + ModelFactors.UpliftCriterionPiping = value; } } @@ -312,7 +312,7 @@ get { return ModelFactors.UpliftCriterionStability; } set { - ModelFactors.UpliftCriterionStability = value; + ModelFactors.UpliftCriterionStability = value; } } @@ -324,7 +324,7 @@ } set { - plLineOffsetBelowDikeTopAtRiver = value; + plLineOffsetBelowDikeTopAtRiver = value; } } @@ -342,7 +342,7 @@ } set { - plLineOffsetBelowDikeTopAtPolder = value; + plLineOffsetBelowDikeTopAtPolder = value; } } @@ -360,7 +360,7 @@ } set { - plLineOffsetBelowShoulderBaseInside = value; + plLineOffsetBelowShoulderBaseInside = value; } } @@ -378,7 +378,7 @@ } set { - plLineOffsetBelowDikeToeAtPolder = value; + plLineOffsetBelowDikeToeAtPolder = value; } } @@ -396,7 +396,7 @@ } set { - usePlLineOffsetBelowDikeCrestMiddle = value; + usePlLineOffsetBelowDikeCrestMiddle = value; } } @@ -411,7 +411,7 @@ get { return plLineOffsetBelowDikeCrestMiddle; } set { - plLineOffsetBelowDikeCrestMiddle = value; + plLineOffsetBelowDikeCrestMiddle = value; } } @@ -429,7 +429,7 @@ } set { - usePlLineOffsetFactorBelowShoulderCrest = value; + usePlLineOffsetFactorBelowShoulderCrest = value; } } @@ -444,7 +444,7 @@ get { return plLineOffsetFactorBelowShoulderCrest; } set { - plLineOffsetFactorBelowShoulderCrest = value; + plLineOffsetFactorBelowShoulderCrest = value; } } @@ -462,7 +462,7 @@ } set { - headPl3 = value; + headPl3 = value; } } @@ -480,7 +480,7 @@ } set { - headPl4 = value; + headPl4 = value; } } @@ -498,7 +498,7 @@ } set { - waterHeightDecimeringsHoogte = value; + waterHeightDecimeringsHoogte = value; } } @@ -516,7 +516,7 @@ } set { - maxWaterLevel = value; + maxWaterLevel = value; } } @@ -545,7 +545,7 @@ if ((defaultUpliftCriterionStability == null) && (ModelFactors.UpliftCriterionStability == null)) { throw new DesignScenarioException(String.Format(LocalizationManager.GetTranslatedText(this, "NoUpliftCriterionForStability"), Location.Name, ToString())); - + } return (ModelFactors.UpliftCriterionStability == null ? defaultUpliftCriterionStability.Value : ModelFactors.UpliftCriterionStability.Value); @@ -905,6 +905,17 @@ if (objectAsKey != null) { return redesignedSurfaceLines.ContainsKey(objectAsKey) ? redesignedSurfaceLines[objectAsKey] ?? Location.SurfaceLine : Location.SurfaceLine; + // For debugging: following code is the same as above, but better debuggable + // SurfaceLine2 surfaceline = Location.SurfaceLine; + // if (redesignedSurfaceLines.ContainsKey(objectAsKey)) + // { + // var s = redesignedSurfaceLines[objectAsKey]; + // if (s != null) + // { + // surfaceline = s; + // } + // } + // return surfaceline; } return null; } @@ -1099,7 +1110,7 @@ HeadPl3 = Convert.ToDouble(parameterValue, numberFormatInfo); if (parameterName.Equals(ScenarioParameterNames.HeadPl4)) HeadPl4 = Convert.ToDouble(parameterValue, numberFormatInfo); - } + } } public static class ScenarioParameterNames Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs =================================================================== diff -u -r1329 -r1349 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs (.../DamMacroStabilityInwardsKernelWrapper.cs) (revision 1329) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs (.../DamMacroStabilityInwardsKernelWrapper.cs) (revision 1349) @@ -572,7 +572,7 @@ // In the first prepareDesign, the initial geometry filename is determined and should be stored in the embankmentDesignParameters embankmentDesignParameters = new EmbankmentDesignParameters() { - EmbankmentMaterialname = location.DikeEmbankmentMaterial, + EmbankmentMaterialname = location.ShoulderEmbankmentMaterial, PreviousGeometry2DFilename = mstabProjectFilename }; FailureMechanismParametersMStab.EmbankmentDesignParameters = embankmentDesignParameters; 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); }