Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/UpliftVanCalculator.cs =================================================================== diff -u -r92bfc045c7d91bd68410e9fd4d61e2b456893b8b -r8df406f63c72b8e32b26259a9b15ad3f5f911970 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/UpliftVanCalculator.cs (.../UpliftVanCalculator.cs) (revision 92bfc045c7d91bd68410e9fd4d61e2b456893b8b) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/UpliftVanCalculator.cs (.../UpliftVanCalculator.cs) (revision 8df406f63c72b8e32b26259a9b15ad3f5f911970) @@ -28,6 +28,7 @@ using Riskeer.MacroStabilityInwards.KernelWrapper.Creators.Output; using Riskeer.MacroStabilityInwards.KernelWrapper.Kernels; using Riskeer.MacroStabilityInwards.KernelWrapper.Kernels.UpliftVan; +using Riskeer.MacroStabilityInwards.KernelWrapper.Kernels.Waternet; namespace Riskeer.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan { @@ -118,8 +119,21 @@ upliftVanKernel.SetMaximumSliceWidth(input.MaximumSliceWidth); upliftVanKernel.SetSoilModel(SoilModelCreator.Create(layersWithSoil.Select(lws => lws.Soil).ToArray())); upliftVanKernel.SetSoilProfile(SoilProfileCreator.Create(input.SoilProfile.PreconsolidationStresses, layersWithSoil)); - upliftVanKernel.SetLocationDaily(UpliftVanStabilityLocationCreator.CreateDaily(input)); - upliftVanKernel.SetSurfaceLine(SurfaceLineCreator.Create(input.SurfaceLine)); + + var waternetDailyKernelWrapper = new WaternetDailyKernelWrapper(); + waternetDailyKernelWrapper.SetLocation(UpliftVanStabilityLocationCreator.CreateDaily(input)); + waternetDailyKernelWrapper.SetSoilProfile(SoilProfileCreator.Create(input.SoilProfile.PreconsolidationStresses, layersWithSoil)); + waternetDailyKernelWrapper.SetSurfaceLine(SurfaceLineCreator.Create(input.SurfaceLine)); + waternetDailyKernelWrapper.Calculate(); + upliftVanKernel.SetWaternetDaily(waternetDailyKernelWrapper.Waternet); + + var waternetExtremeKernelWrapper = new WaternetExtremeKernelWrapper(); + waternetExtremeKernelWrapper.SetLocation(UpliftVanStabilityLocationCreator.CreateExtreme(input)); + waternetExtremeKernelWrapper.SetSoilProfile(SoilProfileCreator.Create(input.SoilProfile.PreconsolidationStresses, layersWithSoil)); + waternetExtremeKernelWrapper.SetSurfaceLine(SurfaceLineCreator.Create(input.SurfaceLine)); + waternetExtremeKernelWrapper.Calculate(); + upliftVanKernel.SetWaternetExtreme(waternetExtremeKernelWrapper.Waternet); + upliftVanKernel.SetSlipPlaneUpliftVan(SlipPlaneUpliftVanCreator.Create(input.SlipPlane)); upliftVanKernel.SetSlipPlaneConstraints(SlipPlaneConstraintsCreator.Create(input.SlipPlaneConstraints)); upliftVanKernel.SetGridAutomaticDetermined(input.SlipPlane.GridAutomaticDetermined); Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Kernels/UpliftVan/IUpliftVanKernel.cs =================================================================== diff -u -r92bfc045c7d91bd68410e9fd4d61e2b456893b8b -r8df406f63c72b8e32b26259a9b15ad3f5f911970 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Kernels/UpliftVan/IUpliftVanKernel.cs (.../IUpliftVanKernel.cs) (revision 92bfc045c7d91bd68410e9fd4d61e2b456893b8b) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Kernels/UpliftVan/IUpliftVanKernel.cs (.../IUpliftVanKernel.cs) (revision 8df406f63c72b8e32b26259a9b15ad3f5f911970) @@ -23,8 +23,8 @@ using Deltares.MacroStability.Data; using Deltares.MacroStability.Geometry; using Deltares.MacroStability.Standard; -using Deltares.MacroStability.WaternetCreator; using Riskeer.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan; +using WtiStabilityWaternet = Deltares.MacroStability.Geometry.Waternet; namespace Riskeer.MacroStabilityInwards.KernelWrapper.Kernels.UpliftVan { @@ -89,12 +89,12 @@ /// /// Sets the location under daily circumstances. /// - void SetLocationDaily(Location stabilityLocation); + void SetWaternetDaily(WtiStabilityWaternet waternetDaily); /// - /// Sets the surface line 2. + /// Sets the location under extreme circumstances. /// - void SetSurfaceLine(SurfaceLine2 surfaceLine2); + void SetWaternetExtreme(WtiStabilityWaternet waternetExtreme); /// /// Sets the move grid property. Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Kernels/UpliftVan/UpliftVanKernelWrapper.cs =================================================================== diff -u -r823c653c7779f7848307f8798a011ad7f33d0356 -r8df406f63c72b8e32b26259a9b15ad3f5f911970 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Kernels/UpliftVan/UpliftVanKernelWrapper.cs (.../UpliftVanKernelWrapper.cs) (revision 823c653c7779f7848307f8798a011ad7f33d0356) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Kernels/UpliftVan/UpliftVanKernelWrapper.cs (.../UpliftVanKernelWrapper.cs) (revision 8df406f63c72b8e32b26259a9b15ad3f5f911970) @@ -27,7 +27,6 @@ using Deltares.MacroStability.Kernel; using Deltares.MacroStability.Preprocessing; using Deltares.MacroStability.Standard; -using Deltares.MacroStability.WaternetCreator; using Deltares.WTIStability.Calculation.Wrapper; using Deltares.WTIStability.IO; using WtiStabilityWaternet = Deltares.MacroStability.Geometry.Waternet; @@ -42,9 +41,9 @@ private readonly StabilityModel stabilityModel; private KernelModel kernelModel; private SoilProfile2D soilProfile2D; - private SurfaceLine2 surfaceLine; - private Location locationDaily; private bool autoGridDetermination; + private WtiStabilityWaternet dailyWaternet; + private WtiStabilityWaternet extremeWaternet; /// /// Creates a new instance of . @@ -79,14 +78,14 @@ public IEnumerable CalculationMessages { get; private set; } - public void SetLocationDaily(Location stabilityLocation) + public void SetWaternetDaily(WtiStabilityWaternet waternetDaily) { - locationDaily = stabilityLocation; + dailyWaternet = waternetDaily; } - public void SetSurfaceLine(SurfaceLine2 surfaceLine2) + public void SetWaternetExtreme(WtiStabilityWaternet waternetExtreme) { - surfaceLine = surfaceLine2; + extremeWaternet = waternetExtreme; } public void SetMoveGrid(bool moveGrid) @@ -135,20 +134,15 @@ }; kernelModel.PreprocessingModel.SearchAreaConditions.AutoSearchArea = autoGridDetermination; - const double unitWeightWater = 9.81; // Taken from kernel - var waternetCreator = new WaternetCreator(unitWeightWater); - locationDaily.Surfaceline = surfaceLine; - locationDaily.SoilProfile2D = soilProfile2D; - var waternet = new WtiStabilityWaternet - { - Name = "WaternetDaily" - }; - waternetCreator.UpdateWaternet(waternet, locationDaily); + ConstructionStage dailyStage = stabilityModel.ConstructionStages.First(); + dailyStage.GeotechnicsData.CurrentWaternet = dailyWaternet; + dailyStage.SoilProfile = soilProfile2D; + + stabilityModel.ConstructionStages.Add(new ConstructionStage()); + ConstructionStage extremeStage = stabilityModel.ConstructionStages.ElementAt(1); + extremeStage.GeotechnicsData.CurrentWaternet = extremeWaternet; + extremeStage.SoilProfile = soilProfile2D; - ConstructionStage stage = stabilityModel.ConstructionStages.First(); - stage.GeotechnicsData.Waternets.Add(waternet); - stage.SoilProfile = soilProfile2D; - var kernelCalculation = new KernelCalculation(); kernelCalculation.Run(kernelModel); Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Kernels/Waternet/WaternetExtremeKernelWrapper.cs =================================================================== diff -u -rf3b6e8a3846acfca0e1ba4108c3eaff77059333a -r8df406f63c72b8e32b26259a9b15ad3f5f911970 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Kernels/Waternet/WaternetExtremeKernelWrapper.cs (.../WaternetExtremeKernelWrapper.cs) (revision f3b6e8a3846acfca0e1ba4108c3eaff77059333a) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Kernels/Waternet/WaternetExtremeKernelWrapper.cs (.../WaternetExtremeKernelWrapper.cs) (revision 8df406f63c72b8e32b26259a9b15ad3f5f911970) @@ -20,6 +20,7 @@ // All rights reserved. using Deltares.WTIStability.Calculation.Wrapper; +using WtiStabilityWaternet = Deltares.MacroStability.Geometry.Waternet; namespace Riskeer.MacroStabilityInwards.KernelWrapper.Kernels.Waternet { @@ -29,5 +30,12 @@ /// internal class WaternetExtremeKernelWrapper : WaternetKernelWrapper { + public WaternetExtremeKernelWrapper() + { + Waternet = new WtiStabilityWaternet + { + Name = "WaternetExtreme" + }; + } } } \ No newline at end of file Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Kernels/Waternet/WaternetKernelWrapper.cs =================================================================== diff -u -rf3b6e8a3846acfca0e1ba4108c3eaff77059333a -r8df406f63c72b8e32b26259a9b15ad3f5f911970 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Kernels/Waternet/WaternetKernelWrapper.cs (.../WaternetKernelWrapper.cs) (revision f3b6e8a3846acfca0e1ba4108c3eaff77059333a) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Kernels/Waternet/WaternetKernelWrapper.cs (.../WaternetKernelWrapper.cs) (revision 8df406f63c72b8e32b26259a9b15ad3f5f911970) @@ -82,7 +82,7 @@ /// are log messages of the type or . private static void ReadLogMessages(IEnumerable receivedLogMessages) { - LogMessage[] errorMessages = receivedLogMessages.Where(lm => lm.MessageType == LogMessageType.FatalError + LogMessage[] errorMessages = receivedLogMessages.Where(lm => lm.MessageType == LogMessageType.FatalError || lm.MessageType == LogMessageType.Error).ToArray(); if (errorMessages.Any()) Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.Test/Kernels/UpliftVan/UpliftVanKernelWrapperTest.cs =================================================================== diff -u -r92bfc045c7d91bd68410e9fd4d61e2b456893b8b -r8df406f63c72b8e32b26259a9b15ad3f5f911970 --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.Test/Kernels/UpliftVan/UpliftVanKernelWrapperTest.cs (.../UpliftVanKernelWrapperTest.cs) (revision 92bfc045c7d91bd68410e9fd4d61e2b456893b8b) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.Test/Kernels/UpliftVan/UpliftVanKernelWrapperTest.cs (.../UpliftVanKernelWrapperTest.cs) (revision 8df406f63c72b8e32b26259a9b15ad3f5f911970) @@ -72,8 +72,6 @@ // Call var kernel = new UpliftVanKernelWrapper(); kernel.SetSoilProfile(soilProfile2D); - kernel.SetLocationDaily(stabilityLocationDaily); - kernel.SetSurfaceLine(surfaceLine); kernel.SetMaximumSliceWidth(maximumSliceWidth); kernel.SetSlipPlaneUpliftVan(slipPlaneUpliftVan); kernel.SetMoveGrid(moveGrid); @@ -256,8 +254,6 @@ } } }); - kernelWrapper.SetLocationDaily(new Location()); - kernelWrapper.SetSurfaceLine(new SurfaceLine2()); kernelWrapper.SetSlipPlaneUpliftVan(new SlipPlaneUpliftVan()); kernelWrapper.SetMoveGrid(true); kernelWrapper.SetMaximumSliceWidth(0); Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.Test/Kernels/Waternet/WaternetDailyKernelWrapperTest.cs =================================================================== diff -u -rf3b6e8a3846acfca0e1ba4108c3eaff77059333a -r8df406f63c72b8e32b26259a9b15ad3f5f911970 --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.Test/Kernels/Waternet/WaternetDailyKernelWrapperTest.cs (.../WaternetDailyKernelWrapperTest.cs) (revision f3b6e8a3846acfca0e1ba4108c3eaff77059333a) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.Test/Kernels/Waternet/WaternetDailyKernelWrapperTest.cs (.../WaternetDailyKernelWrapperTest.cs) (revision 8df406f63c72b8e32b26259a9b15ad3f5f911970) @@ -19,9 +19,6 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using Core.Common.Util.Reflection; -using Deltares.MacroStability.Geometry; -using Deltares.MacroStability.WaternetCreator; using NUnit.Framework; using Riskeer.MacroStabilityInwards.KernelWrapper.Kernels.Waternet; @@ -41,110 +38,27 @@ } [Test] - public void Constructor_CompleteInput_InputCorrectlySetToWrappedKernel() + public void Constructor_Always_SetsCorrectWaternetName() { - // Setup - var stabilityLocation = new Location(); - var soilProfile2D = new SoilProfile2D(); - var surfaceLine = new SurfaceLine2(); - // Call var kernel = new WaternetDailyKernelWrapper(); - kernel.SetLocation(stabilityLocation); - kernel.SetSoilProfile(soilProfile2D); - kernel.SetSurfaceLine(surfaceLine); - // Assert - var location = TypeUtils.GetProperty(kernel, "location"); - - Assert.AreSame(stabilityLocation, location); - Assert.AreSame(surfaceLine, location.Surfaceline); - Assert.AreSame(soilProfile2D, location.SoilProfile2D); - Assert.AreEqual("WaternetDaily", kernel.Waternet.Name); } [Test] public void Calculate_ValidationErrorInCalculation_ThrowsWaternetKernelWrapperException() { // Setup - WaternetDailyKernelWrapper kernel = CreateInvalidKernel(); + var kernel = new WaternetDailyKernelWrapper(); // 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); + Assert.IsNotNull(exception.InnerException); + Assert.AreEqual(exception.InnerException.Message, 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(); - var waternetDailyKernelWrapper = new WaternetDailyKernelWrapper(); - waternetDailyKernelWrapper.SetLocation(new Location()); - waternetDailyKernelWrapper.SetSoilProfile(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 - } - } - }); - waternetDailyKernelWrapper.SetSurfaceLine(new SurfaceLine2()); - - return waternetDailyKernelWrapper; - } } } \ No newline at end of file Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.TestUtil/Kernels/UpliftVan/UpliftVanKernelStub.cs =================================================================== diff -u -r1f993af469f800b98c75c481e0bec6e8010b7a75 -r8df406f63c72b8e32b26259a9b15ad3f5f911970 --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.TestUtil/Kernels/UpliftVan/UpliftVanKernelStub.cs (.../UpliftVanKernelStub.cs) (revision 1f993af469f800b98c75c481e0bec6e8010b7a75) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.TestUtil/Kernels/UpliftVan/UpliftVanKernelStub.cs (.../UpliftVanKernelStub.cs) (revision 8df406f63c72b8e32b26259a9b15ad3f5f911970) @@ -26,6 +26,7 @@ using Deltares.MacroStability.Standard; using Deltares.MacroStability.WaternetCreator; using Riskeer.MacroStabilityInwards.KernelWrapper.Kernels.UpliftVan; +using WtiStabilityWaternet = Deltares.MacroStability.Geometry.Waternet; namespace Riskeer.MacroStabilityInwards.KernelWrapper.TestUtil.Kernels.UpliftVan { @@ -84,6 +85,10 @@ public bool GridAutomaticDetermined { get; private set; } + public WtiStabilityWaternet WaternetDaily { get; private set; } + + public WtiStabilityWaternet WaternetExtreme { get; private set; } + public double FactorOfStability { get; set; } public double ZValue { get; set; } @@ -108,21 +113,16 @@ SoilProfile = soilProfile2D; } - public void SetLocationExtreme(Location stabilityLocation) + public void SetWaternetDaily(WtiStabilityWaternet waternetDaily) { - LocationExtreme = stabilityLocation; + WaternetDaily = waternetDaily; } - public void SetLocationDaily(Location stabilityLocation) + public void SetWaternetExtreme(WtiStabilityWaternet waternetExtreme) { - LocationDaily = stabilityLocation; + WaternetExtreme = waternetExtreme; } - public void SetSurfaceLine(SurfaceLine2 surfaceLine2) - { - SurfaceLine = surfaceLine2; - } - public void SetMoveGrid(bool moveGrid) { MoveGrid = moveGrid;