Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs
===================================================================
diff -u -r1131 -r1137
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs (.../DesignCalculator.cs) (revision 1131)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs (.../DesignCalculator.cs) (revision 1137)
@@ -74,18 +74,20 @@
{
// Prepare input
+ DesignScenario designScenario = location.Scenarios[designScenarioIndex];
var damKernelInput = new DamKernelInput();
var projectPath = damProjectData.ProjectPath != "" ? damProjectData.ProjectPath : Directory.GetCurrentDirectory();
damKernelInput.ProjectDir = projectPath;
damKernelInput.CalculationDir = Path.Combine(projectPath, damProjectData.CalculationMap);
damKernelInput.Location = location;
damKernelInput.SubSoilScenario = soiProfileProbability;
- damKernelInput.DesignScenario = location.Scenarios[designScenarioIndex];
+ //damKernelInput.DesignScenario = location.Scenarios[designScenarioIndex];
damKernelInput.DamFailureMechanismeCalculationSpecification = damProjectData.DamProjectCalculationSpecification.CurrentSpecification;
- damKernelInput.RiverLevelHigh = damKernelInput.DesignScenario.RiverLevel;
- damKernelInput.RiverLevelLow = damKernelInput.DesignScenario.RiverLevelLow;
+ damKernelInput.RiverLevelHigh = designScenario.RiverLevel;
+ damKernelInput.RiverLevelLow = designScenario.RiverLevelLow;
+ damKernelInput.FilenamePrefix = String.Format("Loc({0})_Sce({1})", designScenario.Location.Name, designScenario.LocationScenarioID);
AnalysisType analysisType = DamProjectCalculationSpecification.SelectedAnalysisType;
- SynchronizeDesignScenarioDataWithLocationData(damKernelInput.DesignScenario, damKernelInput.Location);
+ SynchronizeScenarioDataWithLocationData(designScenario, location);
IKernelDataInput kernelDataInput;
IKernelDataOutput kernelDataOutput;
PrepareResult prepareResult = kernelWrapper.Prepare(damKernelInput, 0, out kernelDataInput, out kernelDataOutput);
@@ -98,11 +100,11 @@
{
case AnalysisType.AdaptGeometry:
PerformDesignCalculationShoulderIterativePerPoint(kernelWrapper, kernelDataInput, kernelDataOutput,
- damKernelInput, calculationMessages, damProjectData.DesignCalculations);
+ damKernelInput, designScenario, calculationMessages, damProjectData.DesignCalculations);
break;
case AnalysisType.NoAdaption:
PerformSingleCalculation(kernelWrapper, kernelDataInput, kernelDataOutput,
- damKernelInput, calculationMessages, damProjectData.DesignCalculations);
+ damKernelInput, designScenario, calculationMessages, damProjectData.DesignCalculations);
break;
}
@@ -112,18 +114,16 @@
if (prepareResult == PrepareResult.NotRelevant)
{
calculationMessages.Add(new LogMessage(LogMessageType.Info, null,
- string.Format(Resources.DesignCalculatorIrrelevant,
- location.Name,
- soiProfileProbability.ToString(),
- damKernelInput.DesignScenario.LocationScenarioID)));
+ string.Format(Resources.DesignCalculatorIrrelevant,
+ location.Name,
+ soiProfileProbability.ToString())));
}
if (prepareResult == PrepareResult.Failed)
{
calculationMessages.Add(new LogMessage(LogMessageType.Error, null,
- string.Format(Resources.DesignCalculatorPrepareError,
- location.Name,
- soiProfileProbability.ToString(),
- damKernelInput.DesignScenario.LocationScenarioID)));
+ string.Format(Resources.DesignCalculatorPrepareError,
+ location.Name,
+ soiProfileProbability.ToString())));
}
}
@@ -137,12 +137,11 @@
/// Synchronizes the scenario data with location data.
/// Note that scenario data is leading when available.
///
- /// The design scenario.
+ /// The scenario.
/// The location.
- private void SynchronizeDesignScenarioDataWithLocationData(DesignScenario designScenario, Location location)
+ private void SynchronizeScenarioDataWithLocationData(DesignScenario designScenario, Location location)
{
- // Synchronize PlLinescreator parameters
if (designScenario.PlLineOffsetBelowDikeToeAtPolder.HasValue)
{
location.PlLineOffsetBelowDikeToeAtPolder = designScenario.PlLineOffsetBelowDikeToeAtPolder.Value;
@@ -193,10 +192,25 @@
{
location.ModelFactors.RequiredSafetyFactorPiping = designScenario.RequiredSafetyFactorPiping.Value;
}
+
+ // Synchronize stability design parameters
+ if (designScenario.UpliftCriterionStability.HasValue)
+ {
+ location.UpliftCriterionStability = designScenario.UpliftCriterionStability.Value;
+ }
+ if (designScenario.RequiredSafetyFactorStabilityInnerSlope.HasValue)
+ {
+ location.ModelFactors.RequiredSafetyFactorStabilityInnerSlope = designScenario.RequiredSafetyFactorStabilityInnerSlope.Value;
+ }
+ if (designScenario.RequiredSafetyFactorStabilityOuterSlope.HasValue)
+ {
+ location.ModelFactors.RequiredSafetyFactorStabilityOuterSlope = designScenario.RequiredSafetyFactorStabilityOuterSlope.Value;
+ }
}
- private static void PerformSingleCalculation(IKernelWrapper kernelWrapper, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, DamKernelInput damKernelInput,
- List calculationMessages, List designCalculations)
+ private static void PerformSingleCalculation(IKernelWrapper kernelWrapper, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput,
+ DamKernelInput damKernelInput, DesignScenario designScenario,
+ List calculationMessages, List designCalculations)
{
// Perform validation
var designResults = new List();
@@ -210,8 +224,7 @@
locationCalculationMessages.Add(new LogMessage(LogMessageType.Error, null,
string.Format(Resources.DesignCalculatorValidationFailed,
damKernelInput.Location.Name,
- damKernelInput.SubSoilScenario.ToString(),
- damKernelInput.DesignScenario.LocationScenarioID)));
+ damKernelInput.SubSoilScenario.ToString())));
locationCalculationMessages.AddRange(validationMessages);
}
else
@@ -226,15 +239,14 @@
{
sb.Append(message.Message + Environment.NewLine);
}
-
string resultMessage = sb.ToString();
- kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, resultMessage, out designResults);
+ kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, designScenario, resultMessage, out designResults);
}
catch (Exception exception)
{
string resultMessage = exception.Message;
- kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, resultMessage, out designResults);
+ kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, designScenario, resultMessage, out designResults);
}
finally
{
@@ -304,8 +316,9 @@
/// The calculation messages.
/// The design calculations.
///
- private static void PerformDesignCalculationShoulderIterativePerPoint(IKernelWrapper kernelWrapper, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, DamKernelInput damKernelInput,
- List calculationMessages, List designCalculations)
+ private static void PerformDesignCalculationShoulderIterativePerPoint(IKernelWrapper kernelWrapper, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput,
+ DamKernelInput damKernelInput, DesignScenario designScenario,
+ List calculationMessages, List designCalculations)
{
var designResults = new List();
var location = damKernelInput.Location;
@@ -383,12 +396,12 @@
sb.Append(message.Message + Environment.NewLine);
}
string resultMessage = sb.ToString();
- kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, resultMessage, out designResults);
+ kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, designScenario, resultMessage, out designResults);
}
catch (Exception exception)
{
string resultMessage = exception.Message;
- kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, resultMessage, out designResults);
+ kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, designScenario, resultMessage, out designResults);
}
finally
{
@@ -403,7 +416,7 @@
bool designSuccessful = kernelWrapper.EvaluateDesign(damKernelInput, kernelDataInput, kernelDataOutput, out evaluationMessage);
if (!designSuccessful)
{
- throw new DesignCalculatorException(String.Format(Resources.DesignUnsuccessful,
+ throw new DesignCalculatorException(String.Format(Resources.DesignUnsuccessful,
damKernelInput.Location.Name, damKernelInput.SubSoilScenario) + ", " + evaluationMessage);
}
}