Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorShoulderPerPoint.cs
===================================================================
diff -u -r3893 -r4000
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorShoulderPerPoint.cs (.../DesignCalculatorShoulderPerPoint.cs) (revision 3893)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorShoulderPerPoint.cs (.../DesignCalculatorShoulderPerPoint.cs) (revision 4000)
@@ -27,6 +27,7 @@
using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces;
using Deltares.DamEngine.Calculators.Properties;
using Deltares.DamEngine.Data.Design;
+using Deltares.DamEngine.Data.General;
using Deltares.DamEngine.Data.General.Results;
using Deltares.DamEngine.Data.Geometry;
using Deltares.DamEngine.Data.Geotechnics;
@@ -57,15 +58,15 @@
/// The design calculations.
///
public static void PerformDesignCalculationShoulderPerPoint
- (IKernelWrapper kernelWrapper, IKernelDataInput kernelDataInput,
- IKernelDataOutput kernelDataOutput, DamKernelInput damKernelInput,
- DesignScenario designScenario,
- List calculationMessages, List designCalculations)
+ (IKernelWrapper kernelWrapper, IKernelDataInput kernelDataInput,
+ IKernelDataOutput kernelDataOutput, DamKernelInput damKernelInput,
+ DesignScenario designScenario,
+ List calculationMessages, List designCalculations)
{
var designResults = new List();
- var location = damKernelInput.Location;
- var subSoilScenario = damKernelInput.SubSoilScenario;
- var surfaceLine = designScenario.GetMostRecentSurfaceLine(subSoilScenario.SoilProfile1D, subSoilScenario.SoilProfile2D);
+ Location location = damKernelInput.Location;
+ SoilGeometryProbability subSoilScenario = damKernelInput.SubSoilScenario;
+ SurfaceLine2 surfaceLine = designScenario.GetMostRecentSurfaceLine(subSoilScenario.SoilProfile1D, subSoilScenario.SoilProfile2D);
damKernelInput.Location.SurfaceLine = surfaceLine;
try
{
@@ -77,14 +78,14 @@
IEnumerable relevantSurfacePointsList = from GeometryPoint point in surfaceLine.Geometry.Points
where point.X >= startSurfacePoint.X
- orderby point.X ascending
+ orderby point.X
select point;
relevantSurfacePointsList = GetDiscretizedSurfaceLine(relevantSurfacePointsList);
double desiredShoulderLength = orgShoulderLength;
double oldDesiredShoulderLength = orgShoulderLength;
double desiredShoulderHeight = orgShoulderHeight;
double oldDesiredShoulderHeight = orgShoulderHeight;
- foreach (var point in relevantSurfacePointsList)
+ foreach (GeometryPoint point in relevantSurfacePointsList)
{
// Calculate the piping design at the given point. This returns the required adaption (berm length and height) if any.
ShoulderDesign shoulderDesign = kernelWrapper.CalculateDesignAtPoint(damKernelInput, kernelDataInput, kernelDataOutput, point, out locationCalculationMessages);
@@ -99,16 +100,18 @@
desiredShoulderHeight = Math.Max(desiredShoulderHeight, oldDesiredShoulderHeight);
oldDesiredShoulderHeight = desiredShoulderHeight;
}
-
}
+
if (desiredShoulderLength > 0)
{
desiredShoulderLength = Math.Max(desiredShoulderLength, minimumShoulderLength);
}
+
if (desiredShoulderHeight > 0)
{
desiredShoulderHeight = Math.Max(desiredShoulderHeight, minimumShoulderElevation);
}
+
bool isNewShoulderSameAsOriginal = ((Math.Abs(desiredShoulderLength - orgShoulderLength) < toleranceShoulderChanges) &&
(Math.Abs(desiredShoulderHeight - orgShoulderHeight) < toleranceShoulderChanges));
SurfaceLine2 newSurfaceLine;
@@ -123,19 +126,20 @@
var surfaceLineShoulderAdapter = new SurfaceLineShoulderAdapter(surfaceLine, location, designScenario.PolderLevel);
surfaceLineShoulderAdapter.MaxShoulderLevel = maxShoulderLevel;
newSurfaceLine = surfaceLineShoulderAdapter.ConstructNewSurfaceLine(desiredShoulderLength, desiredShoulderHeight, true);
-
}
+
damKernelInput.Location.SurfaceLine = newSurfaceLine;
kernelWrapper.Prepare(damKernelInput, 0, out kernelDataInput, out kernelDataOutput);
kernelWrapper.Execute(kernelDataInput, kernelDataOutput, out locationCalculationMessages);
// Process output
calculationMessages.AddRange(locationCalculationMessages);
- StringBuilder sb = new StringBuilder();
- foreach (var message in locationCalculationMessages)
+ var sb = new StringBuilder();
+ foreach (LogMessage message in locationCalculationMessages)
{
sb.Append(message.Message + Environment.NewLine);
}
- string resultMessage = sb.ToString();
+
+ var resultMessage = sb.ToString();
kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, designScenario, resultMessage, out designResults);
string evaluationMessage;
@@ -156,7 +160,7 @@
}
finally
{
- foreach (var designResult in designResults)
+ foreach (DesignResult designResult in designResults)
{
designCalculations.Add(designResult);
}
@@ -165,15 +169,15 @@
private static void ChangeSafetyFactor(List designResults, double safetyFactor)
{
- foreach (var designResult in designResults)
+ foreach (DesignResult designResult in designResults)
{
designResult.SafetyFactor = safetyFactor;
}
}
private static void ChangeCalculationResult(List designResults, CalculationResult calculationResult)
{
- foreach (var designResult in designResults)
+ foreach (DesignResult designResult in designResults)
{
designResult.CalculationResult = calculationResult;
}
@@ -187,12 +191,13 @@
///
private static double CalculateMaximumShoulderLevel(SurfaceLine2 surfaceLine, double maxFractionOfDikeHeightForShoulderHeight)
{
- var top = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z;
- var bottom = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z;
+ double top = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z;
+ double bottom = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z;
if (top - bottom <= 0)
{
throw new DesignCalculatorException(Resources.SurfaceLineShoulderAdapterMaxShoulderHeightError);
}
+
double maxHeight = Math.Abs((top - bottom) * maxFractionOfDikeHeightForShoulderHeight);
return bottom + maxHeight;
}
@@ -207,7 +212,7 @@
const double cDiff = 0.5;
var newLine = new List();
double currentX = originalLine.First().X;
- foreach (var point in originalLine)
+ foreach (GeometryPoint point in originalLine)
{
while (point.X > currentX + cDiff)
{
@@ -221,11 +226,14 @@
(point.Z - newLine.Last().Z);
newLine.Add(newPoint);
}
+
currentX = newPoint.X;
}
+
newLine.Add(point);
}
+
return newLine;
}
}
-}
+}
\ No newline at end of file