Index: Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs =================================================================== diff -u -r959924f8d1ddff924bb3306444d1f13fef85e545 -rbf818267e52cd63655978eb8b06d421f5abd5f0a --- Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs (.../WaveHeightCalculationService.cs) (revision 959924f8d1ddff924bb3306444d1f13fef85e545) +++ Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs (.../WaveHeightCalculationService.cs) (revision bf818267e52cd63655978eb8b06d421f5abd5f0a) @@ -114,8 +114,16 @@ try { WaveHeightCalculationInput calculationInput = CreateInput(waveHeightCalculation, norm, hydraulicBoundaryDatabaseFilePath); - calculator.Calculate(calculationInput); + if (waveHeightCalculation.GetCalculateIllustrationPoints()) + { + calculator.CalculateWithIllustrationPoints(calculationInput); + } + else + { + calculator.Calculate(calculationInput); + } + if (!canceled && string.IsNullOrEmpty(calculator.LastErrorFileContent)) { waveHeightCalculation.SetOutput( Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationServiceTest.cs =================================================================== diff -u -r959924f8d1ddff924bb3306444d1f13fef85e545 -rbf818267e52cd63655978eb8b06d421f5abd5f0a --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationServiceTest.cs (.../WaveHeightCalculationServiceTest.cs) (revision 959924f8d1ddff924bb3306444d1f13fef85e545) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationServiceTest.cs (.../WaveHeightCalculationServiceTest.cs) (revision bf818267e52cd63655978eb8b06d421f5abd5f0a) @@ -146,7 +146,8 @@ } [Test] - public void Calculate_ValidHydraulicBoundaryLocation_StartsCalculationWithRightParameters() + public void Calculate_ValidWaveHeightCalculation_StartsCalculationWithRightParameters( + [Values(true, false)] bool withIllustrationPoints) { // Setup string validFilePath = Path.Combine(testDataPath, validFile); @@ -165,6 +166,7 @@ calculation.Stub(c => c.GetName()).Return(locationName); calculation.Expect(c => c.GetId()).Return(id); calculation.Expect(c => c.SetOutput(null)).Constraints(new TypeOf(typeof(HydraulicBoundaryLocationOutput))); + calculation.Expect(c => c.GetCalculateIllustrationPoints()).Return(withIllustrationPoints); var calculationMessageProviderMock = mockRepository.StrictMock(); calculationMessageProviderMock.Stub(calc => calc.GetCalculationName(locationName)).Return(string.Empty); @@ -182,6 +184,8 @@ AssessmentLevelCalculationInput expectedInput = CreateInput(id, norm); AssertInput(expectedInput, calculator.ReceivedInputs.Single()); Assert.IsFalse(calculator.IsCanceled); + + Assert.AreEqual(withIllustrationPoints, calculator.CalculatedWithIllustrationPoints); } mockRepository.VerifyAll(); } @@ -200,6 +204,7 @@ var calculation = mockRepository.Stub(); calculation.Stub(c => c.GetName()).Return("name"); calculation.Expect(c => c.GetId()).Return(0); + calculation.Expect(c => c.GetCalculateIllustrationPoints()).Return(false); var calculationMessageProviderStub = mockRepository.Stub(); mockRepository.ReplayAll(); @@ -247,6 +252,7 @@ var calculation = mockRepository.Stub(); calculation.Stub(c => c.GetName()).Return(locationName); calculation.Expect(c => c.GetId()).Return(0); + calculation.Expect(c => c.GetCalculateIllustrationPoints()).Return(false); var calculationMessageProviderMock = mockRepository.StrictMock(); calculationMessageProviderMock.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName); @@ -311,6 +317,7 @@ var calculation = mockRepository.Stub(); calculation.Stub(c => c.GetName()).Return(locationName); calculation.Expect(c => c.GetId()).Return(0); + calculation.Expect(c => c.GetCalculateIllustrationPoints()).Return(false); var calculationMessageProviderMock = mockRepository.StrictMock(); calculationMessageProviderMock.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName); @@ -376,6 +383,7 @@ var calculation = mockRepository.Stub(); calculation.Stub(c => c.GetName()).Return(locationName); calculation.Expect(c => c.GetId()).Return(0); + calculation.Expect(c => c.GetCalculateIllustrationPoints()).Return(false); var calculationMessageProviderMock = mockRepository.StrictMock(); calculationMessageProviderMock.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName); Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Calculator/IWaveHeightCalculator.cs =================================================================== diff -u -r64d60335b1deab4bafd37f78f3514660cc4afb27 -rbf818267e52cd63655978eb8b06d421f5abd5f0a --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Calculator/IWaveHeightCalculator.cs (.../IWaveHeightCalculator.cs) (revision 64d60335b1deab4bafd37f78f3514660cc4afb27) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Calculator/IWaveHeightCalculator.cs (.../IWaveHeightCalculator.cs) (revision bf818267e52cd63655978eb8b06d421f5abd5f0a) @@ -21,6 +21,7 @@ using Ringtoets.HydraRing.Calculation.Data.Input.Hydraulics; using Ringtoets.HydraRing.Calculation.Exceptions; +using Ringtoets.HydraRing.Calculation.Parsers.IllustrationPoints; namespace Ringtoets.HydraRing.Calculation.Calculator { @@ -41,6 +42,11 @@ double ReliabilityIndex { get; } /// + /// Gets the result of parsing the illustration points in the Hydra-Ring database. + /// + GeneralResult IllustrationPointsResult { get; } + + /// /// Gets the value indicating whether the calculation converged. /// bool? Converged { get; } @@ -64,6 +70,15 @@ void Calculate(WaveHeightCalculationInput input); /// + /// Performs the actual calculation by running the Hydra-Ring executable. + /// Afterwards, sets the . + /// + /// The which contains all the necessary input + /// for the calculation. + /// Thrown when an error occurs while performing the calculation. + void CalculateWithIllustrationPoints(WaveHeightCalculationInput input); + + /// /// Cancels any currently running Hydra-Ring calculation. /// void Cancel(); Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Calculator/WaveHeightCalculator.cs =================================================================== diff -u -r64d60335b1deab4bafd37f78f3514660cc4afb27 -rbf818267e52cd63655978eb8b06d421f5abd5f0a --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Calculator/WaveHeightCalculator.cs (.../WaveHeightCalculator.cs) (revision 64d60335b1deab4bafd37f78f3514660cc4afb27) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Calculator/WaveHeightCalculator.cs (.../WaveHeightCalculator.cs) (revision bf818267e52cd63655978eb8b06d421f5abd5f0a) @@ -24,6 +24,7 @@ using Ringtoets.HydraRing.Calculation.Data; using Ringtoets.HydraRing.Calculation.Data.Input.Hydraulics; using Ringtoets.HydraRing.Calculation.Parsers; +using Ringtoets.HydraRing.Calculation.Parsers.IllustrationPoints; namespace Ringtoets.HydraRing.Calculation.Calculator { @@ -35,6 +36,8 @@ { private readonly ReliabilityIndexCalculationParser targetProbabilityParser; private readonly ConvergenceParser convergenceParser; + private readonly IllustrationPointsParser illustrationPointsParser; + private bool includeIllustrationPoints; /// /// Create a new instance of . @@ -46,16 +49,25 @@ { targetProbabilityParser = new ReliabilityIndexCalculationParser(); convergenceParser = new ConvergenceParser(); + illustrationPointsParser = new IllustrationPointsParser(); WaveHeight = double.NaN; ReliabilityIndex = double.NaN; } + public GeneralResult IllustrationPointsResult { get; private set; } + public double WaveHeight { get; private set; } public double ReliabilityIndex { get; private set; } public bool? Converged { get; private set; } + public void CalculateWithIllustrationPoints(WaveHeightCalculationInput input) + { + includeIllustrationPoints = true; + Calculate(input); + } + public void Calculate(WaveHeightCalculationInput input) { Calculate(HydraRingUncertaintiesType.All, input); @@ -65,6 +77,10 @@ { yield return targetProbabilityParser; yield return convergenceParser; + if (includeIllustrationPoints) + { + yield return illustrationPointsParser; + } } protected override void SetOutputs() @@ -75,6 +91,11 @@ ReliabilityIndex = targetProbabilityParser.Output.CalculatedReliabilityIndex; } Converged = convergenceParser.Output; + + if (includeIllustrationPoints) + { + IllustrationPointsResult = illustrationPointsParser.Output; + } } } } \ No newline at end of file Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.TestUtil/Calculator/TestHydraRingCalculatorFactory.cs =================================================================== diff -u -r78815b3a2e147742759aedddf28c0ada6fb76152 -rbf818267e52cd63655978eb8b06d421f5abd5f0a --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.TestUtil/Calculator/TestHydraRingCalculatorFactory.cs (.../TestHydraRingCalculatorFactory.cs) (revision 78815b3a2e147742759aedddf28c0ada6fb76152) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.TestUtil/Calculator/TestHydraRingCalculatorFactory.cs (.../TestHydraRingCalculatorFactory.cs) (revision bf818267e52cd63655978eb8b06d421f5abd5f0a) @@ -72,19 +72,11 @@ public class TestDesignWaterLevelCalculator : TestHydraRingCalculator, IDesignWaterLevelCalculator { - public bool CalculatedWithIllustrationPoints { get; private set; } public string OutputDirectory { get; set; } public string LastErrorFileContent { get; set; } public double DesignWaterLevel { get; set; } public double ReliabilityIndex { get; set; } - public GeneralResult IllustrationPointsResult { get; } public bool? Converged { get; set; } - - public void CalculateWithIllustrationPoints(AssessmentLevelCalculationInput input) - { - Calculate(input); - CalculatedWithIllustrationPoints = true; - } } public class TestStructuresOvertoppingCalculator : TestHydraRingCalculator, IStructuresOvertoppingCalculator @@ -124,8 +116,11 @@ public readonly List ReceivedInputs = new List(); public event EventHandler CalculationFinishedHandler; public bool EndInFailure { get; set; } - public bool IsCanceled { get; set; } + public bool IsCanceled { get; private set; } + public bool CalculatedWithIllustrationPoints { get; private set; } + public GeneralResult IllustrationPointsResult { get; set; } + public void Calculate(T input) { if (EndInFailure) @@ -137,6 +132,12 @@ CalculationFinished(EventArgs.Empty); } + public void CalculateWithIllustrationPoints(T input) + { + CalculatedWithIllustrationPoints = true; + Calculate(input); + } + public void Cancel() { IsCanceled = true;