Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Converters/MacroStabilityInwardsWaternetConverter.cs
===================================================================
diff -u -r6e703bab0430cff5eb3f81b41b630afbd1d6b59a -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Converters/MacroStabilityInwardsWaternetConverter.cs (.../MacroStabilityInwardsWaternetConverter.cs) (revision 6e703bab0430cff5eb3f81b41b630afbd1d6b59a)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Converters/MacroStabilityInwardsWaternetConverter.cs (.../MacroStabilityInwardsWaternetConverter.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -37,7 +37,7 @@
/// Converts into .
///
/// The result to convert.
- /// The converter
+ /// The converted .
/// Thrown when
/// is null.
public static MacroStabilityInwardsWaternet Convert(WaternetCalculatorResult calculatorResult)
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Ringtoets.MacroStabilityInwards.CalculatedInput.csproj
===================================================================
diff -u -r38b96b5fe034945cfa33600ec134e21507b40922 -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Ringtoets.MacroStabilityInwards.CalculatedInput.csproj (.../Ringtoets.MacroStabilityInwards.CalculatedInput.csproj) (revision 38b96b5fe034945cfa33600ec134e21507b40922)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Ringtoets.MacroStabilityInwards.CalculatedInput.csproj (.../Ringtoets.MacroStabilityInwards.CalculatedInput.csproj) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -34,7 +34,6 @@
-
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/WaternetCalculationService.cs
===================================================================
diff -u -r6e703bab0430cff5eb3f81b41b630afbd1d6b59a -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/WaternetCalculationService.cs (.../WaternetCalculationService.cs) (revision 6e703bab0430cff5eb3f81b41b630afbd1d6b59a)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/WaternetCalculationService.cs (.../WaternetCalculationService.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -38,12 +38,13 @@
public static class WaternetCalculationService
{
///
- /// Calculated the Waternet with extreme circumstances based on the values
+ /// Calculates the Waternet with extreme circumstances based on the values
/// of the .
///
/// The input to get the values from.
/// A calculated ,
- /// or null when the Waternet could be calculated.
+ /// or an empty when the Waternet
+ /// could not be calculated.
/// Thrown when
/// is null.
public static MacroStabilityInwardsWaternet CalculateExtreme(IMacroStabilityInwardsWaternetInput input)
@@ -55,7 +56,7 @@
IWaternetCalculator calculator = MacroStabilityInwardsCalculatorFactory.Instance
.CreateWaternetExtremeCalculator(
- CreateCalculatorInput(input, false),
+ CreateExtremeCalculatorInput(input),
MacroStabilityInwardsKernelWrapperFactory.Instance);
try
@@ -71,12 +72,13 @@
}
///
- /// Calculated the Waternet with daily circumstances based on the values
+ /// Calculates the Waternet with daily circumstances based on the values
/// of the .
///
/// The input to get the values from.
/// A calculated ,
- /// or null when the Waternet could be calculated.
+ /// or an empty when the Waternet
+ /// could not be calculated.
/// Thrown when
/// is null.
public static MacroStabilityInwardsWaternet CalculateDaily(IMacroStabilityInwardsWaternetInput input)
@@ -88,7 +90,7 @@
IWaternetCalculator calculator = MacroStabilityInwardsCalculatorFactory.Instance
.CreateWaternetDailyCalculator(
- CreateCalculatorInput(input, true),
+ CreateDailyCalculatorInput(input),
MacroStabilityInwardsKernelWrapperFactory.Instance);
try
@@ -103,25 +105,40 @@
}
}
- private static WaternetCalculatorInput CreateCalculatorInput(IMacroStabilityInwardsWaternetInput input, bool daily)
+ private static WaternetCalculatorInput CreateDailyCalculatorInput(IMacroStabilityInwardsWaternetInput input)
{
- return new WaternetCalculatorInput(new WaternetCalculatorInput.ConstructionProperties
+ WaternetCalculatorInput.ConstructionProperties properties = CreateCalculatorInputConstructionProperties(input);
+ properties.PhreaticLineOffsets = PhreaticLineOffsetsConverter.Convert(input.LocationInputDaily);
+ properties.AssessmentLevel = input.WaterLevelRiverAverage;
+ properties.WaterLevelPolder = input.LocationInputDaily.WaterLevelPolder;
+ properties.PenetrationLength = input.LocationInputDaily.PenetrationLength;
+
+ return new WaternetCalculatorInput(properties);
+ }
+
+ private static WaternetCalculatorInput CreateExtremeCalculatorInput(IMacroStabilityInwardsWaternetInput input)
+ {
+ WaternetCalculatorInput.ConstructionProperties properties = CreateCalculatorInputConstructionProperties(input);
+ properties.PhreaticLineOffsets = PhreaticLineOffsetsConverter.Convert(input.LocationInputExtreme);
+ properties.AssessmentLevel = input.AssessmentLevel;
+ properties.WaterLevelPolder = input.LocationInputExtreme.WaterLevelPolder;
+ properties.PenetrationLength = input.LocationInputExtreme.PenetrationLength;
+
+ return new WaternetCalculatorInput(properties);
+ }
+
+ private static WaternetCalculatorInput.ConstructionProperties CreateCalculatorInputConstructionProperties(IMacroStabilityInwardsWaternetInput input)
+ {
+ return new WaternetCalculatorInput.ConstructionProperties
{
WaternetCreationMode = WaternetCreationMode.CreateWaternet,
PlLineCreationMethod = PlLineCreationMethod.RingtoetsWti2017,
- AssessmentLevel = input.AssessmentLevel,
LandwardDirection = LandwardDirection.PositiveX,
SurfaceLine = input.SurfaceLine,
SoilProfile = SoilProfileConverter.Convert(input.SoilProfileUnderSurfaceLine),
DrainageConstruction = DrainageConstructionConverter.Convert(input),
- PhreaticLineOffsets = daily
- ? PhreaticLineOffsetsConverter.Convert(input.LocationInputDaily)
- : PhreaticLineOffsetsConverter.Convert(input.LocationInputExtreme),
DikeSoilScenario = input.DikeSoilScenario,
WaterLevelRiverAverage = input.WaterLevelRiverAverage,
- WaterLevelPolder = daily
- ? input.LocationInputDaily.WaterLevelPolder
- : input.LocationInputExtreme.WaterLevelPolder,
MinimumLevelPhreaticLineAtDikeTopRiver = input.MinimumLevelPhreaticLineAtDikeTopRiver,
MinimumLevelPhreaticLineAtDikeTopPolder = input.MinimumLevelPhreaticLineAtDikeTopPolder,
LeakageLengthOutwardsPhreaticLine3 = input.LeakageLengthOutwardsPhreaticLine3,
@@ -130,11 +147,8 @@
LeakageLengthInwardsPhreaticLine4 = input.LeakageLengthInwardsPhreaticLine4,
PiezometricHeadPhreaticLine2Outwards = input.PiezometricHeadPhreaticLine2Outwards,
PiezometricHeadPhreaticLine2Inwards = input.PiezometricHeadPhreaticLine2Inwards,
- PenetrationLength = daily
- ? input.LocationInputDaily.PenetrationLength
- : input.LocationInputExtreme.PenetrationLength,
AdjustPhreaticLine3And4ForUplift = input.AdjustPhreaticLine3And4ForUplift
- });
+ };
}
}
}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsWaternetProperties.cs
===================================================================
diff -u -rf5c00f7fb200387f33023622372196697c1a249b -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsWaternetProperties.cs (.../MacroStabilityInwardsWaternetProperties.cs) (revision f5c00f7fb200387f33023622372196697c1a249b)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsWaternetProperties.cs (.../MacroStabilityInwardsWaternetProperties.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -59,7 +59,6 @@
[ResourcesDisplayName(typeof(Resources), nameof(Resources.PhreaticLines_DisplayName))]
[ResourcesDescription(typeof(Resources), nameof(Resources.PhreaticLines_Description))]
[TypeConverter(typeof(ExpandableReadOnlyArrayConverter))]
-
public MacroStabilityInwardsPhreaticLineProperties[] PhreaticLines
{
get
@@ -73,7 +72,6 @@
[ResourcesDisplayName(typeof(Resources), nameof(Resources.WaternetLines_DisplayName))]
[ResourcesDescription(typeof(Resources), nameof(Resources.WaternetLines_Description))]
[TypeConverter(typeof(ExpandableReadOnlyArrayConverter))]
-
public MacroStabilityInwardsWaternetLineProperties[] WaternetLines
{
get
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/IMacroStabilityInwardsCalculatorFactory.cs
===================================================================
diff -u -r63f6b06168b756e6bd94c7b764c2c6e426a5badb -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/IMacroStabilityInwardsCalculatorFactory.cs (.../IMacroStabilityInwardsCalculatorFactory.cs) (revision 63f6b06168b756e6bd94c7b764c2c6e426a5badb)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/IMacroStabilityInwardsCalculatorFactory.cs (.../IMacroStabilityInwardsCalculatorFactory.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -19,6 +19,7 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan;
using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan.Input;
using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.Waternet;
@@ -39,6 +40,8 @@
/// for performing an Uplift Van calculation.
/// The factory responsible for creating the Uplift Van kernel.
/// The Uplift Van calculator.
+ /// Thrown when any parameter
+ /// is null.
IUpliftVanCalculator CreateUpliftVanCalculator(UpliftVanCalculatorInput input, IMacroStabilityInwardsKernelFactory factory);
///
@@ -48,15 +51,19 @@
/// for performing a Waternet calculation.
/// The factory responsible for creating the Waternet kernel.
/// The Waternet calculator.
+ /// Thrown when any parameter
+ /// is null.
IWaternetCalculator CreateWaternetExtremeCalculator(WaternetCalculatorInput input, IMacroStabilityInwardsKernelFactory factory);
-
+
///
/// Creates a Waternet calculator for the daily circumstances.
///
/// The containing all the values required
/// for performing a Waternet calculation.
/// The factory responsible for creating the Waternet kernel.
/// The Waternet calculator.
+ /// Thrown when any parameter
+ /// is null.
IWaternetCalculator CreateWaternetDailyCalculator(WaternetCalculatorInput input, IMacroStabilityInwardsKernelFactory factory);
}
}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/Input/WaternetCalculatorInput.cs
===================================================================
diff -u -r4061c28197adfa0f3dc171c74fbe300ecb3a89c4 -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/Input/WaternetCalculatorInput.cs (.../WaternetCalculatorInput.cs) (revision 4061c28197adfa0f3dc171c74fbe300ecb3a89c4)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/Input/WaternetCalculatorInput.cs (.../WaternetCalculatorInput.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -36,7 +36,7 @@
/// The object containing the values for the properties
/// of the new .
/// Thrown when is null.
- /// /// Thrown when one of the following properties is null:
+ /// Thrown when one of the following properties is null:
///
/// - ;
/// - ;
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/Output/WaternetCalculatorResult.cs
===================================================================
diff -u -r262e5ee967e56798894d0ea3167d110d0aea9684 -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/Output/WaternetCalculatorResult.cs (.../WaternetCalculatorResult.cs) (revision 262e5ee967e56798894d0ea3167d110d0aea9684)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/Output/WaternetCalculatorResult.cs (.../WaternetCalculatorResult.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -36,7 +36,8 @@
/// The waternet lines.
/// Thrown when
/// or is null.
- internal WaternetCalculatorResult(IEnumerable phreaticLines, IEnumerable waternetLines)
+ internal WaternetCalculatorResult(IEnumerable phreaticLines,
+ IEnumerable waternetLines)
{
if (phreaticLines == null)
{
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/WaternetCalculator.cs
===================================================================
diff -u -r9b68b88ccc29f7a24829149d8f4e098d950f942c -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/WaternetCalculator.cs (.../WaternetCalculator.cs) (revision 9b68b88ccc29f7a24829149d8f4e098d950f942c)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/WaternetCalculator.cs (.../WaternetCalculator.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -22,14 +22,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Deltares.WTIStability.Data.Geo;
+using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.Input;
using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.Waternet.Input;
using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.Waternet.Output;
using Ringtoets.MacroStabilityInwards.KernelWrapper.Creators.Input;
using Ringtoets.MacroStabilityInwards.KernelWrapper.Creators.Output;
using Ringtoets.MacroStabilityInwards.KernelWrapper.Kernels;
using Ringtoets.MacroStabilityInwards.KernelWrapper.Kernels.Waternet;
-using SoilLayer = Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.Input.SoilLayer;
+using WtiStabilitySoil = Deltares.WTIStability.Data.Geo.Soil;
namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.Waternet
{
@@ -44,8 +44,8 @@
/// The containing all the values
/// required for performing the Waternet calculation.
/// The factory responsible for creating the Waternet kernel.
- /// Thrown when or
- /// is null.
+ /// Thrown when any parameter
+ /// is null.
protected WaternetCalculator(WaternetCalculatorInput input, IMacroStabilityInwardsKernelFactory factory)
{
if (input == null)
@@ -68,11 +68,6 @@
}
///
- /// Gets the input of the calculation.
- ///
- protected WaternetCalculatorInput Input { get; }
-
- ///
/// Gets the factory responsible for creating the Waternet kernel.
///
protected IMacroStabilityInwardsKernelFactory Factory { get; }
@@ -83,10 +78,18 @@
/// The created .
protected abstract IWaternetKernel CreateWaternetKernel();
+ private WaternetCalculatorInput Input { get; }
+
+ ///
+ /// Performs the Waternet calculation.
+ ///
+ /// The Waternet kernel with output set.
+ /// Thrown when the Waternet
+ /// kernel throws a .
private IWaternetKernel CalculateWaternet()
{
IWaternetKernel waternetKernel = CreateWaternetKernel();
- SetinputOnKernel(waternetKernel);
+ SetInputOnKernel(waternetKernel);
try
{
@@ -100,10 +103,10 @@
return waternetKernel;
}
- private void SetinputOnKernel(IWaternetKernel waternetKernel)
+ private void SetInputOnKernel(IWaternetKernel waternetKernel)
{
- Soil[] soils = SoilCreator.Create(Input.SoilProfile);
- Dictionary layersWithSoils =
+ WtiStabilitySoil[] soils = SoilCreator.Create(Input.SoilProfile);
+ Dictionary layersWithSoils =
Input.SoilProfile.Layers
.Zip(soils, (layer, soil) => new
{
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/WaternetDailyCalculator.cs
===================================================================
diff -u -r9b68b88ccc29f7a24829149d8f4e098d950f942c -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/WaternetDailyCalculator.cs (.../WaternetDailyCalculator.cs) (revision 9b68b88ccc29f7a24829149d8f4e098d950f942c)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/WaternetDailyCalculator.cs (.../WaternetDailyCalculator.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -37,8 +37,8 @@
/// The containing all the values
/// required for performing the Waternet calculation.
/// The factory responsible for creating the Waternet kernel.
- /// Thrown when or
- /// is null.
+ /// Thrown when any parameter
+ /// is null.
public WaternetDailyCalculator(WaternetCalculatorInput input, IMacroStabilityInwardsKernelFactory factory)
: base(input, factory) {}
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/WaternetExtremeCalculator.cs
===================================================================
diff -u -r9b68b88ccc29f7a24829149d8f4e098d950f942c -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/WaternetExtremeCalculator.cs (.../WaternetExtremeCalculator.cs) (revision 9b68b88ccc29f7a24829149d8f4e098d950f942c)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/WaternetExtremeCalculator.cs (.../WaternetExtremeCalculator.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -37,8 +37,8 @@
/// The containing all the values
/// required for performing the Waternet calculation.
/// The factory responsible for creating the Waternet kernel.
- /// Thrown when or
- /// is null.
+ /// Thrown when any parameter
+ /// is null.
public WaternetExtremeCalculator(WaternetCalculatorInput input, IMacroStabilityInwardsKernelFactory factory)
: base(input, factory) {}
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/Input/SoilCreator.cs
===================================================================
diff -u -r9f35261205f8f664dc06e652f6d264ad9fee7bd9 -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/Input/SoilCreator.cs (.../SoilCreator.cs) (revision 9f35261205f8f664dc06e652f6d264ad9fee7bd9)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/Input/SoilCreator.cs (.../SoilCreator.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -22,40 +22,38 @@
using System;
using System.ComponentModel;
using System.Linq;
-using Deltares.WTIStability.Data.Geo;
+using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.Input;
using Ringtoets.MacroStabilityInwards.KernelWrapper.Kernels.UpliftVan;
-using DilatancyType = Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.Input.DilatancyType;
-using ShearStrengthModel = Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.Input.ShearStrengthModel;
-using SoilProfile = Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.Input.SoilProfile;
+using WtiStabilitySoil = Deltares.WTIStability.Data.Geo.Soil;
using WtiStabilityDilatancyType = Deltares.WTIStability.Data.Geo.DilatancyType;
using WtiStabilityShearStrengthModel = Deltares.WTIStability.Data.Geo.ShearStrengthModel;
namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Creators.Input
{
///
- /// Creates instances which are required by .
+ /// Creates instances which are required by .
///
internal static class SoilCreator
{
///
- /// Creates a based on information contained in the profile ,
+ /// Creates a based on information contained in the profile ,
/// which can be used by .
///
/// The from which to take the information.
- /// A new with information taken from the .
+ /// A new with information taken from the .
/// Thrown when is null.
/// Thrown when
/// or is an invalid value.
/// Thrown when
/// or is a valid value but unsupported.
- public static Soil[] Create(SoilProfile profile)
+ public static WtiStabilitySoil[] Create(SoilProfile profile)
{
if (profile == null)
{
throw new ArgumentNullException(nameof(profile));
}
- return profile.Layers.Select(l => new Soil(l.MaterialName)
+ return profile.Layers.Select(l => new WtiStabilitySoil(l.MaterialName)
{
UsePop = l.UsePop,
ShearStrengthModel = ConvertShearStrengthModel(l.ShearStrengthModel),
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Kernels/Waternet/WaternetDailyKernelWrapper.cs
===================================================================
diff -u -r9f775510c22e91baf217e8958afe1000b565cb97 -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Kernels/Waternet/WaternetDailyKernelWrapper.cs (.../WaternetDailyKernelWrapper.cs) (revision 9f775510c22e91baf217e8958afe1000b565cb97)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Kernels/Waternet/WaternetDailyKernelWrapper.cs (.../WaternetDailyKernelWrapper.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -21,6 +21,7 @@
using Deltares.WTIStability;
using Deltares.WTIStability.Calculation.Wrapper;
+using Deltares.WTIStability.IO;
using WtiStabilityWaternet = Deltares.WTIStability.Data.Geo.Waternet;
namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Kernels.Waternet
@@ -32,7 +33,6 @@
internal class WaternetDailyKernelWrapper : WaternetKernelWrapper
{
public WaternetDailyKernelWrapper()
- : base(true)
{
StabilityModel.GeotechnicsData.CurrentWaternetDaily = new WtiStabilityWaternet
{
@@ -47,5 +47,15 @@
StabilityModel.LocationDaily = value;
}
}
+
+ protected override string CreateWaternetXmlResult(WTIStabilityCalculation waternetCalculation)
+ {
+ return waternetCalculation.CreateWaternet(true);
+ }
+
+ protected override WtiStabilityWaternet ReadResult(string waternetXmlResult)
+ {
+ return WTIDeserializer.DeserializeWaternetUsedDuringCalculation(waternetXmlResult, true);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Kernels/Waternet/WaternetExtremeKernelWrapper.cs
===================================================================
diff -u -r9f775510c22e91baf217e8958afe1000b565cb97 -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Kernels/Waternet/WaternetExtremeKernelWrapper.cs (.../WaternetExtremeKernelWrapper.cs) (revision 9f775510c22e91baf217e8958afe1000b565cb97)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Kernels/Waternet/WaternetExtremeKernelWrapper.cs (.../WaternetExtremeKernelWrapper.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -21,6 +21,8 @@
using Deltares.WTIStability;
using Deltares.WTIStability.Calculation.Wrapper;
+using Deltares.WTIStability.IO;
+using WtiStabilityWaternet = Deltares.WTIStability.Data.Geo.Waternet;
namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Kernels.Waternet
{
@@ -30,15 +32,22 @@
///
internal class WaternetExtremeKernelWrapper : WaternetKernelWrapper
{
- public WaternetExtremeKernelWrapper()
- : base(false) {}
-
public override StabilityLocation Location
{
set
{
StabilityModel.Location = value;
}
}
+
+ protected override string CreateWaternetXmlResult(WTIStabilityCalculation waternetCalculation)
+ {
+ return waternetCalculation.CreateWaternet(false);
+ }
+
+ protected override WtiStabilityWaternet ReadResult(string waternetXmlResult)
+ {
+ return WTIDeserializer.DeserializeWaternetUsedDuringCalculation(waternetXmlResult, false);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Kernels/Waternet/WaternetKernelWrapper.cs
===================================================================
diff -u -rf2eea656d0dcf8ed238cad8822bd7310840b45c4 -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Kernels/Waternet/WaternetKernelWrapper.cs (.../WaternetKernelWrapper.cs) (revision f2eea656d0dcf8ed238cad8822bd7310840b45c4)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Kernels/Waternet/WaternetKernelWrapper.cs (.../WaternetKernelWrapper.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -36,18 +36,12 @@
///
internal abstract class WaternetKernelWrapper : IWaternetKernel
{
- private readonly bool calculateDaily;
- private readonly StabilityModel stabilityModel;
-
///
/// Creates a new instance of .
///
- /// Indicator whether the daily waternet
- /// should be calculated.
- protected WaternetKernelWrapper(bool calculateDaily)
+ protected WaternetKernelWrapper()
{
- this.calculateDaily = calculateDaily;
- stabilityModel = new StabilityModel();
+ StabilityModel = new StabilityModel();
}
public abstract StabilityLocation Location { set; }
@@ -56,23 +50,23 @@
{
set
{
- stabilityModel.SoilModel = value;
+ StabilityModel.SoilModel = value;
}
}
public SoilProfile2D SoilProfile
{
set
{
- stabilityModel.SoilProfile = value;
+ StabilityModel.SoilProfile = value;
}
}
public SurfaceLine2 SurfaceLine
{
set
{
- stabilityModel.SurfaceLine2 = value;
+ StabilityModel.SurfaceLine2 = value;
}
}
@@ -83,11 +77,11 @@
try
{
var waternetCalculation = new WTIStabilityCalculation();
- waternetCalculation.InitializeForDeterministic(WTISerializer.Serialize(stabilityModel));
+ waternetCalculation.InitializeForDeterministic(WTISerializer.Serialize(StabilityModel));
- string waternetXmlResult = waternetCalculation.CreateWaternet(calculateDaily);
+ string waternetXmlResult = CreateWaternetXmlResult(waternetCalculation);
ReadValidationResult(waternetXmlResult);
- ReadResult(waternetXmlResult);
+ Waternet = ReadResult(waternetXmlResult);
}
catch (Exception e) when (!(e is WaternetKernelWrapperException))
{
@@ -98,19 +92,12 @@
///
/// Gets the stability model of the kernel.
///
- protected StabilityModel StabilityModel
- {
- get
- {
- return stabilityModel;
- }
- }
+ protected StabilityModel StabilityModel { get; }
- private void ReadResult(string waternetXmlResult)
- {
- Waternet = WTIDeserializer.DeserializeWaternetUsedDuringCalculation(waternetXmlResult, calculateDaily);
- }
+ protected abstract string CreateWaternetXmlResult(WTIStabilityCalculation waternetCalculation);
+ protected abstract WtiStabilityWaternet ReadResult(string waternetXmlResult);
+
///
/// Reads the validation results of the calculation.
///
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Converters/DrainageConstructionConverterTest.cs
===================================================================
diff -u -rcfa7dc2bce5e37f5677d9c8772b68599f9e26a0c -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Converters/DrainageConstructionConverterTest.cs (.../DrainageConstructionConverterTest.cs) (revision cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Converters/DrainageConstructionConverterTest.cs (.../DrainageConstructionConverterTest.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -20,7 +20,7 @@
// All rights reserved.
using System;
-using Core.Common.Base.Data;
+using Core.Common.TestUtil;
using NUnit.Framework;
using Ringtoets.MacroStabilityInwards.CalculatedInput.Converters;
using Ringtoets.MacroStabilityInwards.Data;
@@ -46,70 +46,75 @@
[Test]
[TestCase(MacroStabilityInwardsDikeSoilScenario.SandDikeOnSand)]
[TestCase(MacroStabilityInwardsDikeSoilScenario.SandDikeOnClay)]
- public void Convert_SandDikeAndDrainageConstructionPresentTrue_ReturnUpliftVanDrainageConstruction(MacroStabilityInwardsDikeSoilScenario soilScenario)
+ public void Convert_SandDikeAndDrainageConstructionPresentTrue_ReturnDrainageConstruction(MacroStabilityInwardsDikeSoilScenario soilScenario)
{
// Setup
+ var random = new Random(21);
var input = new MacroStabilityInwardsInput
{
DrainageConstructionPresent = true,
- XCoordinateDrainageConstruction = (RoundedDouble) 2,
- ZCoordinateDrainageConstruction = (RoundedDouble) 4,
+ XCoordinateDrainageConstruction = random.NextRoundedDouble(),
+ ZCoordinateDrainageConstruction = random.NextRoundedDouble(),
DikeSoilScenario = soilScenario
};
// Call
DrainageConstruction drainageConstruction = DrainageConstructionConverter.Convert(input);
// Assert
- Assert.IsTrue((bool) drainageConstruction.IsPresent);
+ Assert.IsTrue(drainageConstruction.IsPresent);
Assert.AreEqual(input.XCoordinateDrainageConstruction, drainageConstruction.XCoordinate);
Assert.AreEqual(input.ZCoordinateDrainageConstruction, drainageConstruction.ZCoordinate);
}
+ [Test]
[TestCase(MacroStabilityInwardsDikeSoilScenario.ClayDikeOnSand)]
[TestCase(MacroStabilityInwardsDikeSoilScenario.ClayDikeOnClay)]
[TestCase(MacroStabilityInwardsDikeSoilScenario.SandDikeOnSand)]
[TestCase(MacroStabilityInwardsDikeSoilScenario.SandDikeOnClay)]
- public void Convert_DrainageConstructionPresentFalse_ReturnUpliftVanDrainageConstruction(MacroStabilityInwardsDikeSoilScenario soilScenario)
+ public void Convert_DrainageConstructionPresentFalse_ReturnDrainageConstruction(MacroStabilityInwardsDikeSoilScenario soilScenario)
{
// Setup
+ var random = new Random(21);
var input = new MacroStabilityInwardsInput
{
DrainageConstructionPresent = false,
- XCoordinateDrainageConstruction = (RoundedDouble) 2,
- ZCoordinateDrainageConstruction = (RoundedDouble) 4,
+ XCoordinateDrainageConstruction = random.NextRoundedDouble(),
+ ZCoordinateDrainageConstruction = random.NextRoundedDouble(),
DikeSoilScenario = soilScenario
};
// Call
DrainageConstruction drainageConstruction = DrainageConstructionConverter.Convert(input);
// Assert
- Assert.IsFalse((bool) drainageConstruction.IsPresent);
- Assert.IsNaN((double) drainageConstruction.XCoordinate);
- Assert.IsNaN((double) drainageConstruction.ZCoordinate);
+ Assert.IsFalse(drainageConstruction.IsPresent);
+ Assert.IsNaN(drainageConstruction.XCoordinate);
+ Assert.IsNaN(drainageConstruction.ZCoordinate);
}
+ [Test]
[TestCase(MacroStabilityInwardsDikeSoilScenario.ClayDikeOnSand)]
[TestCase(MacroStabilityInwardsDikeSoilScenario.ClayDikeOnClay)]
- public void Convert_ClayDikeAndDrainageConstructionPresentTrue_ReturnUpliftVanDrainageConstruction(MacroStabilityInwardsDikeSoilScenario soilScenario)
+ public void Convert_ClayDikeAndDrainageConstructionPresentTrue_ReturnDrainageConstruction(MacroStabilityInwardsDikeSoilScenario soilScenario)
{
// Setup
+ var random = new Random(21);
var input = new MacroStabilityInwardsInput
{
DrainageConstructionPresent = true,
- XCoordinateDrainageConstruction = (RoundedDouble) 2,
- ZCoordinateDrainageConstruction = (RoundedDouble) 4,
+ XCoordinateDrainageConstruction = random.NextRoundedDouble(),
+ ZCoordinateDrainageConstruction = random.NextRoundedDouble(),
DikeSoilScenario = soilScenario
};
// Call
DrainageConstruction drainageConstruction = DrainageConstructionConverter.Convert(input);
// Assert
- Assert.IsFalse((bool) drainageConstruction.IsPresent);
- Assert.IsNaN((double) drainageConstruction.XCoordinate);
- Assert.IsNaN((double) drainageConstruction.ZCoordinate);
+ Assert.IsFalse(drainageConstruction.IsPresent);
+ Assert.IsNaN(drainageConstruction.XCoordinate);
+ Assert.IsNaN(drainageConstruction.ZCoordinate);
}
}
}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Converters/MacroStabilityInwardsWaternetConverterTest.cs
===================================================================
diff -u -r38b96b5fe034945cfa33600ec134e21507b40922 -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Converters/MacroStabilityInwardsWaternetConverterTest.cs (.../MacroStabilityInwardsWaternetConverterTest.cs) (revision 38b96b5fe034945cfa33600ec134e21507b40922)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Converters/MacroStabilityInwardsWaternetConverterTest.cs (.../MacroStabilityInwardsWaternetConverterTest.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -20,7 +20,6 @@
// All rights reserved.
using System;
-using System.Linq;
using NUnit.Framework;
using Ringtoets.MacroStabilityInwards.CalculatedInput.Converters;
using Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil;
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Converters/PhreaticLineOffsetsConverterTest.cs
===================================================================
diff -u -rbd0a78dc9dd218a799c43b114725f6efa4da1687 -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Converters/PhreaticLineOffsetsConverterTest.cs (.../PhreaticLineOffsetsConverterTest.cs) (revision bd0a78dc9dd218a799c43b114725f6efa4da1687)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Converters/PhreaticLineOffsetsConverterTest.cs (.../PhreaticLineOffsetsConverterTest.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -44,7 +44,7 @@
}
[Test]
- public void Convert_UseDefaultOffsetsTrue_ReturnUpliftVanPhreaticLineOffsets()
+ public void Convert_UseDefaultOffsetsTrue_ReturnPhreaticLineOffsets()
{
// Setup
var random = new Random(11);
@@ -70,7 +70,7 @@
}
[Test]
- public void Convert_UseDefaultOffsetsFalse_ReturnUpliftVanPhreaticLineOffsets()
+ public void Convert_UseDefaultOffsetsFalse_ReturnPhreaticLineOffsets()
{
// Setup
var random = new Random(11);
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Converters/SoilProfileConverterTest.cs
===================================================================
diff -u -rb976e43b1c5480a6bcb004c58c307d69ebe9f4a2 -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Converters/SoilProfileConverterTest.cs (.../SoilProfileConverterTest.cs) (revision b976e43b1c5480a6bcb004c58c307d69ebe9f4a2)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Converters/SoilProfileConverterTest.cs (.../SoilProfileConverterTest.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -51,7 +51,7 @@
}
[Test]
- public void Convert_WithSoilProfile_ReturnUpliftVanSoilProfile()
+ public void Convert_WithSoilProfile_ReturnSoilProfile()
{
// Setup
var random = new Random(22);
@@ -147,8 +147,8 @@
[TestCase(MacroStabilityInwardsShearStrengthModel.CPhi, ShearStrengthModel.CPhi)]
[TestCase(MacroStabilityInwardsShearStrengthModel.CPhiOrSuCalculated, ShearStrengthModel.CPhiOrSuCalculated)]
[TestCase(MacroStabilityInwardsShearStrengthModel.SuCalculated, ShearStrengthModel.SuCalculated)]
- public void Convert_ValidShearStrengthModel_ReturnExpectedUpliftVanShearStrengthModel(MacroStabilityInwardsShearStrengthModel originalShearStrengthModel,
- ShearStrengthModel expectedShearStrengthModel)
+ public void Convert_ValidShearStrengthModel_ReturnExpectedShearStrengthModel(MacroStabilityInwardsShearStrengthModel originalShearStrengthModel,
+ ShearStrengthModel expectedShearStrengthModel)
{
// Setup
var profile = new MacroStabilityInwardsSoilProfileUnderSurfaceLine(new[]
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test.csproj
===================================================================
diff -u -rbd0a78dc9dd218a799c43b114725f6efa4da1687 -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test.csproj (.../Ringtoets.MacroStabilityInwards.CalculatedInput.Test.csproj) (revision bd0a78dc9dd218a799c43b114725f6efa4da1687)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test.csproj (.../Ringtoets.MacroStabilityInwards.CalculatedInput.Test.csproj) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -51,7 +51,6 @@
-
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/WaternetCalculationServiceTest.cs
===================================================================
diff -u -r6e703bab0430cff5eb3f81b41b630afbd1d6b59a -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/WaternetCalculationServiceTest.cs (.../WaternetCalculationServiceTest.cs) (revision 6e703bab0430cff5eb3f81b41b630afbd1d6b59a)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/WaternetCalculationServiceTest.cs (.../WaternetCalculationServiceTest.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -72,8 +72,9 @@
CalculatorInputAssert.AssertPhreaticLineOffsets(input.LocationInputExtreme, actualInput.PhreaticLineOffsets);
Assert.AreEqual(input.LocationInputExtreme.WaterLevelPolder, actualInput.WaterLevelPolder);
Assert.AreEqual(input.LocationInputExtreme.PenetrationLength, actualInput.PenetrationLength);
+ Assert.AreEqual(input.AssessmentLevel, actualInput.AssessmentLevel);
- AssertGenericInput(input, factory);
+ AssertGenericInput(input, actualInput);
}
}
@@ -141,8 +142,9 @@
CalculatorInputAssert.AssertPhreaticLineOffsets(input.LocationInputDaily, actualInput.PhreaticLineOffsets);
Assert.AreEqual(input.LocationInputDaily.WaterLevelPolder, actualInput.WaterLevelPolder);
Assert.AreEqual(input.LocationInputDaily.PenetrationLength, actualInput.PenetrationLength);
+ Assert.AreEqual(input.WaterLevelRiverAverage, actualInput.AssessmentLevel);
- AssertGenericInput(input, factory);
+ AssertGenericInput(input, actualInput);
}
}
@@ -181,21 +183,16 @@
}
}
- private static void AssertGenericInput(IMacroStabilityInwardsWaternetInput originalInput, TestMacroStabilityInwardsCalculatorFactory factory)
+ private static void AssertGenericInput(IMacroStabilityInwardsWaternetInput originalInput, WaternetCalculatorInput actualInput)
{
- WaternetCalculatorInput actualInput = factory.LastCreatedWaternetCalculator.Input;
CalculatorInputAssert.AssertSoilProfile(originalInput.SoilProfileUnderSurfaceLine, actualInput.SoilProfile);
CalculatorInputAssert.AssertDrainageConstruction(originalInput, actualInput.DrainageConstruction);
Assert.AreEqual(WaternetCreationMode.CreateWaternet, actualInput.WaternetCreationMode);
Assert.AreEqual(PlLineCreationMethod.RingtoetsWti2017, actualInput.PlLineCreationMethod);
Assert.AreEqual(LandwardDirection.PositiveX, actualInput.LandwardDirection);
Assert.AreSame(originalInput.SurfaceLine, actualInput.SurfaceLine);
- Assert.AreEqual(originalInput.AssessmentLevel, actualInput.AssessmentLevel);
Assert.AreEqual(originalInput.DikeSoilScenario, actualInput.DikeSoilScenario);
Assert.AreEqual(originalInput.WaterLevelRiverAverage, actualInput.WaterLevelRiverAverage);
- Assert.AreEqual(originalInput.DrainageConstructionPresent, actualInput.DrainageConstruction.IsPresent);
- Assert.AreEqual(originalInput.XCoordinateDrainageConstruction, actualInput.DrainageConstruction.XCoordinate);
- Assert.AreEqual(originalInput.ZCoordinateDrainageConstruction, actualInput.DrainageConstruction.ZCoordinate);
Assert.AreEqual(originalInput.MinimumLevelPhreaticLineAtDikeTopRiver, actualInput.MinimumLevelPhreaticLineAtDikeTopRiver);
Assert.AreEqual(originalInput.MinimumLevelPhreaticLineAtDikeTopPolder, actualInput.MinimumLevelPhreaticLineAtDikeTopPolder);
Assert.AreEqual(originalInput.LeakageLengthOutwardsPhreaticLine3, actualInput.LeakageLengthOutwardsPhreaticLine3);
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/CalculatorInputAssert.cs
===================================================================
diff -u -r714a022526f42b64abd36e5a3320b4c294013064 -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/CalculatorInputAssert.cs (.../CalculatorInputAssert.cs) (revision 714a022526f42b64abd36e5a3320b4c294013064)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/CalculatorInputAssert.cs (.../CalculatorInputAssert.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -19,6 +19,7 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System.ComponentModel;
using System.Linq;
using NUnit.Framework;
using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.Input;
@@ -120,6 +121,7 @@
Assert.AreEqual(expectedData.IsAquifer, actual[i].IsAquifer);
Assert.AreEqual(DilatancyType.Zero, actual[i].DilatancyType);
Assert.AreEqual(WaterPressureInterpolationModel.Automatic, actual[i].WaterPressureInterpolationModel);
+ Assert.AreEqual(ConvertShearStrengthModel(expectedData.ShearStrengthModel), actual[i].ShearStrengthModel);
Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetAbovePhreaticLevel(expectedData).GetDesignValue(), actual[i].AbovePhreaticLevel);
Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetBelowPhreaticLevel(expectedData).GetDesignValue(), actual[i].BelowPhreaticLevel);
@@ -130,5 +132,27 @@
Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPop(expectedData).GetDesignValue(), actual[i].Pop);
}
}
+
+ ///
+ /// Converts to a .
+ ///
+ /// The original shear strength model
+ /// A converted shear strength model
+ /// Thrown when
+ /// is an invalid value.
+ private static ShearStrengthModel ConvertShearStrengthModel(MacroStabilityInwardsShearStrengthModel shearStrengthModel)
+ {
+ switch (shearStrengthModel)
+ {
+ case MacroStabilityInwardsShearStrengthModel.SuCalculated:
+ return ShearStrengthModel.SuCalculated;
+ case MacroStabilityInwardsShearStrengthModel.CPhi:
+ return ShearStrengthModel.CPhi;
+ case MacroStabilityInwardsShearStrengthModel.CPhiOrSuCalculated:
+ return ShearStrengthModel.CPhiOrSuCalculated;
+ default:
+ throw new InvalidEnumArgumentException();
+ }
+ }
}
}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/CalculatorOutputAssert.cs
===================================================================
diff -u -r38b96b5fe034945cfa33600ec134e21507b40922 -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/CalculatorOutputAssert.cs (.../CalculatorOutputAssert.cs) (revision 38b96b5fe034945cfa33600ec134e21507b40922)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/CalculatorOutputAssert.cs (.../CalculatorOutputAssert.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -59,7 +59,8 @@
Assert.AreEqual(originalWaternetLines[i].Name, actualWaternetLines[i].Name);
CollectionAssert.AreEqual(originalWaternetLines[i].Geometry, actualWaternetLines[i].Geometry);
Assert.AreEqual(originalWaternetLines[i].PhreaticLine.Name, actualWaternetLines[i].PhreaticLine.Name);
+ CollectionAssert.AreEqual(originalWaternetLines[i].PhreaticLine.Geometry, actualWaternetLines[i].PhreaticLine.Geometry);
}
}
}
-}
+}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil.csproj
===================================================================
diff -u -r38b96b5fe034945cfa33600ec134e21507b40922 -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil.csproj (.../Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil.csproj) (revision 38b96b5fe034945cfa33600ec134e21507b40922)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil.csproj (.../Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil.csproj) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -44,7 +44,6 @@
-
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsCalculationScenarioFactory.cs
===================================================================
diff -u -rb2f4b307c254c747a5cf01d2fb94970e5e954c36 -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsCalculationScenarioFactory.cs (.../MacroStabilityInwardsCalculationScenarioFactory.cs) (revision b2f4b307c254c747a5cf01d2fb94970e5e954c36)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsCalculationScenarioFactory.cs (.../MacroStabilityInwardsCalculationScenarioFactory.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -234,6 +234,7 @@
StochasticSoilProfile = stochasticSoilProfile,
HydraulicBoundaryLocation = hydraulicBoundaryLocation,
DikeSoilScenario = MacroStabilityInwardsDikeSoilScenario.SandDikeOnClay,
+ WaterLevelRiverAverage = (RoundedDouble) 1.5,
LocationInputExtreme =
{
WaterLevelPolder = (RoundedDouble) 0.5,
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Kernels/Waternet/WaternetDailyKernelWrapperTest.cs
===================================================================
diff -u -r9f775510c22e91baf217e8958afe1000b565cb97 -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Kernels/Waternet/WaternetDailyKernelWrapperTest.cs (.../WaternetDailyKernelWrapperTest.cs) (revision 9f775510c22e91baf217e8958afe1000b565cb97)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Kernels/Waternet/WaternetDailyKernelWrapperTest.cs (.../WaternetDailyKernelWrapperTest.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -38,8 +38,6 @@
// Assert
Assert.IsInstanceOf(kernel);
- var calculateDaily = TypeUtils.GetField(kernel, "calculateDaily");
- Assert.IsTrue(calculateDaily);
}
[Test]
@@ -74,6 +72,96 @@
AssertAutomaticallySyncedValues(stabilityModel, soilProfile2D, surfaceLine);
}
+ [Test]
+ public void Calculate_ValidationErrorInCalculation_ThrowsWaternetKernelWrapperException()
+ {
+ // Setup
+ WaternetDailyKernelWrapper kernel = CreateInvalidKernel();
+
+ // Call
+ TestDelegate test = () => kernel.Calculate();
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Waternet-Beoordeling: De punten in de hoogtegeometrie zijn niet oplopend. (x-waarde)\r\n" +
+ "Waternet-Dagelijks: De punten in de hoogtegeometrie zijn niet oplopend. (x-waarde)", exception.Message);
+ }
+
+ private static WaternetDailyKernelWrapper CreateInvalidKernel()
+ {
+ var point1 = new Point2D(0, 0);
+ var point2 = new Point2D(1, 1);
+ var point3 = new Point2D(2, 2);
+ var point4 = new Point2D(3, 3);
+ var curve1 = new GeometryCurve(point1, point2);
+ var curve2 = new GeometryCurve(point2, point3);
+ var curve3 = new GeometryCurve(point3, point4);
+ var curve4 = new GeometryCurve(point4, point1);
+ var loop = new GeometryLoop
+ {
+ CurveList =
+ {
+ curve1,
+ curve2,
+ curve3,
+ curve4
+ }
+ };
+ var geometrySurface = new GeometrySurface
+ {
+ OuterLoop = loop
+ };
+ var soil = new Soil();
+ return new WaternetDailyKernelWrapper
+ {
+ SurfaceLine = new SurfaceLine2(),
+ Location = new StabilityLocation(),
+ SoilProfile = new SoilProfile2D
+ {
+ Geometry = new GeometryData
+ {
+ Points =
+ {
+ point1,
+ point2,
+ point3,
+ point4
+ },
+ Curves =
+ {
+ curve1,
+ curve2,
+ curve3,
+ curve4
+ },
+ Loops =
+ {
+ loop
+ },
+ Surfaces =
+ {
+ geometrySurface
+ }
+ },
+ Surfaces =
+ {
+ new SoilLayer2D
+ {
+ GeometrySurface = geometrySurface,
+ Soil = soil
+ }
+ }
+ },
+ SoilModel = new SoilModel
+ {
+ Soils =
+ {
+ soil
+ }
+ }
+ };
+ }
+
private static void AssertAutomaticallySyncedValues(StabilityModel stabilityModel, SoilProfile2D soilProfile2D, SurfaceLine2 surfaceLine)
{
Assert.AreSame(stabilityModel, stabilityModel.LocationDaily.StabilityModel);
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Kernels/Waternet/WaternetExtremeKernelWrapperTest.cs
===================================================================
diff -u -r9f775510c22e91baf217e8958afe1000b565cb97 -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Kernels/Waternet/WaternetExtremeKernelWrapperTest.cs (.../WaternetExtremeKernelWrapperTest.cs) (revision 9f775510c22e91baf217e8958afe1000b565cb97)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Kernels/Waternet/WaternetExtremeKernelWrapperTest.cs (.../WaternetExtremeKernelWrapperTest.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -38,9 +38,6 @@
// Assert
Assert.IsInstanceOf(kernel);
-
- var calculateDaily = TypeUtils.GetField(kernel, "calculateDaily");
- Assert.IsFalse(calculateDaily);
}
[Test]
@@ -74,6 +71,95 @@
AssertAutomaticallySyncedValues(stabilityModel, soilProfile2D, surfaceLine);
}
+ [Test]
+ public void Calculate_ValidationErrorInCalculation_ThrowsWaternetKernelWrapperException()
+ {
+ // Setup
+ WaternetExtremeKernelWrapper kernel = CreateInvalidKernel();
+
+ // Call
+ TestDelegate test = () => kernel.Calculate();
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Waternet-Beoordeling: De punten in de hoogtegeometrie zijn niet oplopend. (x-waarde)", exception.Message);
+ }
+
+ private static WaternetExtremeKernelWrapper CreateInvalidKernel()
+ {
+ var point1 = new Point2D(0, 0);
+ var point2 = new Point2D(1, 1);
+ var point3 = new Point2D(2, 2);
+ var point4 = new Point2D(3, 3);
+ var curve1 = new GeometryCurve(point1, point2);
+ var curve2 = new GeometryCurve(point2, point3);
+ var curve3 = new GeometryCurve(point3, point4);
+ var curve4 = new GeometryCurve(point4, point1);
+ var loop = new GeometryLoop
+ {
+ CurveList =
+ {
+ curve1,
+ curve2,
+ curve3,
+ curve4
+ }
+ };
+ var geometrySurface = new GeometrySurface
+ {
+ OuterLoop = loop
+ };
+ var soil = new Soil();
+ return new WaternetExtremeKernelWrapper
+ {
+ SurfaceLine = new SurfaceLine2(),
+ Location = new StabilityLocation(),
+ SoilProfile = new SoilProfile2D
+ {
+ Geometry = new GeometryData
+ {
+ Points =
+ {
+ point1,
+ point2,
+ point3,
+ point4
+ },
+ Curves =
+ {
+ curve1,
+ curve2,
+ curve3,
+ curve4
+ },
+ Loops =
+ {
+ loop
+ },
+ Surfaces =
+ {
+ geometrySurface
+ }
+ },
+ Surfaces =
+ {
+ new SoilLayer2D
+ {
+ GeometrySurface = geometrySurface,
+ Soil = soil
+ }
+ }
+ },
+ SoilModel = new SoilModel
+ {
+ Soils =
+ {
+ soil
+ }
+ }
+ };
+ }
+
private static void AssertAutomaticallySyncedValues(StabilityModel stabilityModel, SoilProfile2D soilProfile2D, SurfaceLine2 surfaceLine)
{
Assert.AreSame(stabilityModel, stabilityModel.Location.StabilityModel);
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Kernels/Waternet/WaternetKernelWrapperTest.cs
===================================================================
diff -u -r9f775510c22e91baf217e8958afe1000b565cb97 -r68f204f50eaf5f1e881c18fb2d878a17c722f75a
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Kernels/Waternet/WaternetKernelWrapperTest.cs (.../WaternetKernelWrapperTest.cs) (revision 9f775510c22e91baf217e8958afe1000b565cb97)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Kernels/Waternet/WaternetKernelWrapperTest.cs (.../WaternetKernelWrapperTest.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a)
@@ -21,9 +21,11 @@
using Core.Common.Utils.Reflection;
using Deltares.WTIStability;
+using Deltares.WTIStability.Calculation.Wrapper;
using Deltares.WTIStability.Data.Geo;
using NUnit.Framework;
using Ringtoets.MacroStabilityInwards.KernelWrapper.Kernels.Waternet;
+using WtiStabilityWaternet = Deltares.WTIStability.Data.Geo.Waternet;
namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Test.Kernels.Waternet
{
@@ -93,101 +95,12 @@
// Call
TestDelegate test = () => kernel.Calculate();
-
+
// Assert
Assert.Throws(test);
Assert.IsNull(kernel.Waternet);
}
- [Test]
- public void Calculate_ValidationErrorInCalculation_ThrowsWaternetKernelWrapperException()
- {
- // Setup
- WaternetKernelWrapper kernel = CreateInvalidKernel();
-
- // Call
- TestDelegate test = () => kernel.Calculate();
-
- // Assert
- var exception = Assert.Throws(test);
- Assert.AreEqual("Waternet-Beoordeling: De punten in de hoogtegeometrie zijn niet oplopend. (x-waarde)", exception.Message);
- }
-
- private static WaternetKernelWrapper CreateInvalidKernel()
- {
- var point1 = new Point2D(0, 0);
- var point2 = new Point2D(1, 1);
- var point3 = new Point2D(2, 2);
- var point4 = new Point2D(3, 3);
- var curve1 = new GeometryCurve(point1, point2);
- var curve2 = new GeometryCurve(point2, point3);
- var curve3 = new GeometryCurve(point3, point4);
- var curve4 = new GeometryCurve(point4, point1);
- var loop = new GeometryLoop
- {
- CurveList =
- {
- curve1,
- curve2,
- curve3,
- curve4
- }
- };
- var geometrySurface = new GeometrySurface
- {
- OuterLoop = loop
- };
- var soil = new Soil();
- return new TestWaternetKernelWrapper
- {
- SurfaceLine = new SurfaceLine2(),
- Location = new StabilityLocation(),
- SoilProfile = new SoilProfile2D
- {
- Geometry = new GeometryData
- {
- Points =
- {
- point1,
- point2,
- point3,
- point4
- },
- Curves =
- {
- curve1,
- curve2,
- curve3,
- curve4
- },
- Loops =
- {
- loop
- },
- Surfaces =
- {
- geometrySurface
- }
- },
- Surfaces =
- {
- new SoilLayer2D
- {
- GeometrySurface = geometrySurface,
- Soil = soil
- }
- }
- },
- SoilModel = new SoilModel
- {
- Soils =
- {
- soil
- }
- }
- };
- }
-
private static void AssertIrrelevantValues(StabilityModel stabilityModel)
{
Assert.IsNaN(stabilityModel.SlipPlaneConstraints.XEntryMin); // Not applicable for Waternet calculation
@@ -227,15 +140,23 @@
private class TestWaternetKernelWrapper : WaternetKernelWrapper
{
- public TestWaternetKernelWrapper() : base(false) {}
-
public override StabilityLocation Location
{
set
{
StabilityModel.Location = value;
}
}
+
+ protected override string CreateWaternetXmlResult(WTIStabilityCalculation waternetCalculation)
+ {
+ return null;
+ }
+
+ protected override WtiStabilityWaternet ReadResult(string waternetXmlResult)
+ {
+ return null;
+ }
}
}
}
\ No newline at end of file