Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx
===================================================================
diff -u -r1914 -r1927
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 1914)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 1927)
@@ -294,4 +294,7 @@
No calculator object defined for WBI Macro Stability
+
+ Prepare of calculator for WBI Macro Stability did not succeed
+
\ No newline at end of file
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamWbiMacroStabilityInwards/DamWbiMacroStabilityInwardsKernelWrapperTests.cs
===================================================================
diff -u -r1924 -r1927
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamWbiMacroStabilityInwards/DamWbiMacroStabilityInwardsKernelWrapperTests.cs (.../DamWbiMacroStabilityInwardsKernelWrapperTests.cs) (revision 1924)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamWbiMacroStabilityInwards/DamWbiMacroStabilityInwardsKernelWrapperTests.cs (.../DamWbiMacroStabilityInwardsKernelWrapperTests.cs) (revision 1927)
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Data;
using Deltares.DamEngine.Calculators.KernelWrappers.Common;
+using Deltares.DamEngine.Calculators.KernelWrappers.DamMacroStabilityCommon;
using Deltares.DamEngine.Calculators.KernelWrappers.DamWbiMacroStabilityInwards;
using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces;
using Deltares.DamEngine.Calculators.Tests.KernelWrappers.DamMacroStabilityCommon;
@@ -23,6 +24,7 @@
{
var kernelWrapper = new DamWbiMacroStabilityInwardsKernelWrapper();
kernelWrapper.CreateWbiStabilityCalculator();
+ kernelWrapper.FailureMechanismParametersMStab = new FailureMechanismParametersMStab();
IKernelDataInput kernelDataInput;
IKernelDataOutput kernelDataOutput;
@@ -145,6 +147,7 @@
var kernelWrapper = new DamWbiMacroStabilityInwardsKernelWrapper();
kernelWrapper.CreateWbiStabilityCalculator();
+ kernelWrapper.FailureMechanismParametersMStab = new FailureMechanismParametersMStab();
// Prepare the wrapper. Result is input for the calculation dll
IKernelDataInput kernelDataInput;
@@ -235,10 +238,11 @@
[SetUICulture("nl-NL")]
public void TestThrowsExceptionWhenDamKernelIsNull()
{
+ List messages;
var kernelWrapper = new DamWbiMacroStabilityInwardsKernelWrapper();
- IKernelDataInput kernelDataInput;
- IKernelDataOutput kernelDataOutput;
- kernelWrapper.Prepare(null, 0, out kernelDataInput, out kernelDataOutput);
+ IKernelDataInput kernelDataInput = new DamMacroStabilityInput();
+ IKernelDataOutput kernelDataOutput = new DamMacroStabilityOutput();
+ kernelWrapper.Validate(kernelDataInput, kernelDataOutput, out messages);
}
private static DamKernelInput CreateDamKernelInputForTest()
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx
===================================================================
diff -u -r1914 -r1927
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 1914)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 1927)
@@ -180,6 +180,9 @@
Geen uitvoer object gedefinieerd voor WBI Macrostabiliteit
+
+ Voorbereiding van het rekenhart voor WBI Macrostabiliteit is niet geslaagd.
+
Locatie '{0}', ondergrond scenario '{1}', ontwerp scenario '{2}': De berekening is mislukt met de volgende foutmelding '{3}'.
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs
===================================================================
diff -u -r1914 -r1927
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1914)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1927)
@@ -254,6 +254,15 @@
}
///
+ /// Looks up a localized string similar to Prepare of calculator for WBI Macro Stability did not succeed.
+ ///
+ internal static string DamWbiMacroStabilityKernelWrapper_PrepareForWbiMacroStabilityDidNotSucceed {
+ get {
+ return ResourceManager.GetString("DamWbiMacroStabilityKernelWrapper_PrepareForWbiMacroStabilityDidNotSucceed", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Location '{0}', subsoil scenario '{1}', design scenario '{2}': The calculation failed with error message '{3}'.
///
internal static string DesignCalculatorGeneralException {
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamWbiMacroStabilityInwards/DamWbiMacroStabilityInwardsKernelWrapper.cs
===================================================================
diff -u -r1925 -r1927
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamWbiMacroStabilityInwards/DamWbiMacroStabilityInwardsKernelWrapper.cs (.../DamWbiMacroStabilityInwardsKernelWrapper.cs) (revision 1925)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamWbiMacroStabilityInwards/DamWbiMacroStabilityInwardsKernelWrapper.cs (.../DamWbiMacroStabilityInwardsKernelWrapper.cs) (revision 1927)
@@ -4,6 +4,7 @@
using System.Linq;
using Deltares.DamEngine.Calculators.DikesDesign;
using Deltares.DamEngine.Calculators.KernelWrappers.Common;
+using Deltares.DamEngine.Calculators.KernelWrappers.DamMacroStabilityCommon;
using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces;
using Deltares.DamEngine.Calculators.Properties;
using Deltares.DamEngine.Data.Design;
@@ -21,6 +22,15 @@
{
private WTIStabilityCalculation wbiMacroStabilityCalculator = null;
private int lastIterationIndex = 0;
+
+ ///
+ /// Gets or sets the failure mechanisme paramaters for mstab.
+ ///
+ ///
+ /// The failure mechanisme paramaters mstab.
+ ///
+ public FailureMechanismParametersMStab FailureMechanismParametersMStab { get; set; } //ToDo MWDAM-? Use same as for DGeoStability or create new one for WBI?
+
public bool tmpPresumePrepareSucceeds; //ToDo MWDAM-1356
public bool tmpPresumePrepareIsUplift; //ToDo MWDAM-? Determine Uplift for Wbi, same as for DGeoStability?
public bool tmpPresumeInputValid; //ToDo MWDAM-1367
@@ -38,7 +48,6 @@
///
public PrepareResult Prepare(DamKernelInput damKernelInput, int iterationIndex, out IKernelDataInput kernelDataInput, out IKernelDataOutput kernelDataOutput)
{
- ThrowWhenWbiMacroStabilityCalculatorNull(wbiMacroStabilityCalculator);
var macroStabilityInput = new DamWbiMacroStabilityInput();
kernelDataInput = macroStabilityInput;
var macroStabilityOutput = new DamWbiMacroStabilityOutput
@@ -56,18 +65,9 @@
kernelDataOutput = macroStabilityOutput;
if (upliftSituation.IsUplift)
{
- var xmlInput = CreateXmlInput(macroStabilityInput);
- // ToDo MWDAM-1356: Not clear yet what parts are required for input. Temporary test code added.
- //ToDo wbiMacroStabilityCalculator.InitializeForDeterministic(xmlInput);
- //ToDo return PrepareResult.Successful;
- if (tmpPresumePrepareSucceeds)
- {
- return PrepareResult.Successful;
- }
- else
- {
- return PrepareResult.Failed;
- }
+ // ToDo MWDAM-1356: Not clear yet what parts are required for input.
+ var xmlInput = CreateXmlInput(macroStabilityInput, FailureMechanismParametersMStab.EmbankmentDesignParameters);
+ return PrepareKernel(xmlInput);
}
else
{
@@ -81,9 +81,33 @@
return PrepareResult.Failed;
}
}
-
- private string CreateXmlInput(DamWbiMacroStabilityInput macroStabilityInput)
+
+ private PrepareResult PrepareKernel(string xmlInput)
{
+ ThrowWhenWbiMacroStabilityCalculatorNull(wbiMacroStabilityCalculator);
+ try
+ {
+ // ToDo MWDAM-1356: Not clear yet what parts are required for input. Temporary test code added.
+ //wbiMacroStabilityCalculator.InitializeForDeterministic(xmlInput); //ToDo: uncomment when input is set
+ //return PrepareResult.Successful; //ToDo: uncomment when input is set
+ if (tmpPresumePrepareSucceeds) //ToDo: remove the temporary test code when input is set
+ {
+ return PrepareResult.Successful;
+ }
+ else
+ {
+ return PrepareResult.Failed;
+ }
+
+ }
+ catch
+ {
+ return PrepareResult.Failed;
+ }
+ }
+
+ private string CreateXmlInput(DamWbiMacroStabilityInput macroStabilityInput, EmbankmentDesignParameters embankmentDesignParameters)
+ {
string xmlInput = "";
//ToDo in MWDAM-1356
return xmlInput;
@@ -384,11 +408,61 @@
return isDesignReady;
}
+ ///
+ /// Prepares the design.
+ ///
+ /// The kernel data input.
+ /// The kernel data output.
+ /// The dam kernel input.
+ /// Index of the iteration.
+ /// The embankment design parameters.
public void PrepareDesign(IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, DamKernelInput damKernelInput,
int iterationIndex, out EmbankmentDesignParameters embankmentDesignParameters)
{
- // ToDo: Not clear yet if this must be done or how
- throw new NotImplementedException();
+ DamWbiMacroStabilityInput macroStabilityInput = kernelDataInput as DamWbiMacroStabilityInput;
+ ThrowWhenWbiMacroStabilityKernelInputNull(macroStabilityInput);
+
+ lastIterationIndex = iterationIndex;
+ MStabModelType model = MStabModelType.UpliftVan;
+ var location = damKernelInput.Location;
+ //ToDo MWDAM-1356: Not clear yet what parts are required for input. subSoilScenario, riverLevel and others might be necessary for CreateXmlInput
+ //var subSoilScenario = damKernelInput.SubSoilScenario;
+ //double riverLevel = damKernelInput.RiverLevelHigh;
+ EmbankmentDesignParameters embankmentDesignParametersForKernelInput;
+ if (iterationIndex < 1)
+ {
+ // This is the first (initial) call to prepareDesign.
+ // The embankment material is set to DikeEmbankmentMaterial, because the next iteration (Index = 1) will be height adaption
+ embankmentDesignParameters = new EmbankmentDesignParameters()
+ {
+ EmbankmentMaterialname = location.DikeEmbankmentMaterial,
+ };
+ //ToDo MWDAM-? Use FailureMechanismParametersMStab or create new one for WBI?
+ FailureMechanismParametersMStab.EmbankmentDesignParameters = embankmentDesignParameters;
+ embankmentDesignParametersForKernelInput = null;
+ }
+ else
+ {
+ // Calculation iterations start with IterationIndex = 1.
+ // When IterationIndex = 1: height adaption.
+ // When Iteration > 1: Slope/Shoulder adaption.
+ // Starting from IterationIndex 2 the following parameters should be used:
+ // - The embankment material is set to ShoulderEmbankmentMaterial.
+ // - The previous geometry is set to the height adapted geometry (name is constructed with iteration index 1).
+ if (iterationIndex == 2)
+ {
+ FailureMechanismParametersMStab.EmbankmentDesignParameters.EmbankmentMaterialname = location.ShoulderEmbankmentMaterial;
+ }
+ // In the following prepareDesign calls just return the stored embankmentDesignParameters
+ embankmentDesignParameters = FailureMechanismParametersMStab.EmbankmentDesignParameters;
+ embankmentDesignParametersForKernelInput = embankmentDesignParameters;
+ }
+ var xmlInput = CreateXmlInput(macroStabilityInput, embankmentDesignParametersForKernelInput);
+ var prepareResult = PrepareKernel(xmlInput);
+ if (prepareResult != PrepareResult.Successful)
+ {
+ throw new MacroStabilityException(Resources.DamWbiMacroStabilityKernelWrapper_PrepareForWbiMacroStabilityDidNotSucceed);
+ }
}
///