Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Service/WaveConditionsCalculationServiceBase.cs =================================================================== diff -u -re3dfee35e824946dbdc46353425a493d77b2a0c8 -r5f79a720fc22eee311073ce2af9ab7613b2d357b --- Ringtoets/Revetment/src/Ringtoets.Revetment.Service/WaveConditionsCalculationServiceBase.cs (.../WaveConditionsCalculationServiceBase.cs) (revision e3dfee35e824946dbdc46353425a493d77b2a0c8) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.Service/WaveConditionsCalculationServiceBase.cs (.../WaveConditionsCalculationServiceBase.cs) (revision 5f79a720fc22eee311073ce2af9ab7613b2d357b) @@ -22,7 +22,6 @@ using System; using System.Collections.Generic; using System.Globalization; -using System.IO; using System.Linq; using Core.Common.Base.Data; using Core.Common.Base.IO; @@ -124,18 +123,16 @@ /// The 'b' factor decided on failure mechanism level. /// The 'c' factor decided on failure mechanism level. /// The norm to use as the target. - /// The file path of the hydraulic boundary database. - /// The preprocessor directory. + /// The hydraulic boundary database to perform the calculations with. /// An of . - /// Preprocessing is disabled when equals . - /// Thrown when , - /// or - /// is null. - /// Thrown when the + /// Preprocessing is disabled when the preprocessor directory equals . + /// Thrown when or + /// is null. + /// Thrown when the hydraulic boundary database file path /// contains invalid characters. /// Thrown when: /// - /// No settings database file could be found at the location of + /// No settings database file could be found at the location of the hydraulic boundary database file path /// with the same name. /// Unable to open settings database file. /// Unable to read required data from database file. @@ -149,14 +146,18 @@ RoundedDouble b, RoundedDouble c, double norm, - string hydraulicBoundaryDatabaseFilePath, - string preprocessorDirectory) + HydraulicBoundaryDatabase hydraulicBoundaryDatabase) { if (waveConditionsInput == null) { throw new ArgumentNullException(nameof(waveConditionsInput)); } + if (hydraulicBoundaryDatabase == null) + { + throw new ArgumentNullException(nameof(hydraulicBoundaryDatabase)); + } + var calculationsFailed = 0; var outputs = new List(); @@ -177,8 +178,7 @@ c, norm, waveConditionsInput, - hydraulicBoundaryDatabaseFilePath, - preprocessorDirectory); + HydraulicBoundaryCalculationSettingsFactory.CreateSettings(hydraulicBoundaryDatabase)); if (output != null) { @@ -255,17 +255,15 @@ /// The 'c' factor decided on failure mechanism level. /// The norm to use as the target. /// The input that is different per calculation. - /// The path which points to the hydraulic boundary database file. - /// The preprocessor directory. + /// The containing all data + /// to perform a hydraulic boundary calculation. /// A if the calculation was successful; or null if it was canceled. - /// Preprocessing is disabled when equals . - /// Thrown when or - /// is null. - /// Thrown when the + /// Preprocessing is disabled when the preprocessor directory equals . + /// Thrown when the hydraulic boundary database file path /// contains invalid characters. /// Thrown when: /// - /// No settings database file could be found at the location of + /// No settings database file could be found at the location of the hydraulic boundary database file path /// with the same name. /// Unable to open settings database file. /// Unable to read required data from database file. @@ -277,13 +275,11 @@ RoundedDouble c, double norm, WaveConditionsInput input, - string hydraulicBoundaryDatabaseFilePath, - string preprocessorDirectory) + HydraulicBoundaryCalculationSettings calculationSettings) { - var settings = new HydraRingCalculationSettings(hydraulicBoundaryDatabaseFilePath, preprocessorDirectory); + HydraRingCalculationSettings settings = HydraRingCalculationSettingsFactory.CreateSettings(calculationSettings); calculator = HydraRingCalculatorFactory.Instance.CreateWaveConditionsCosineCalculator(settings); - WaveConditionsCosineCalculationInput calculationInput = CreateInput(waterLevel, a, b, c, norm, input, hydraulicBoundaryDatabaseFilePath, - !string.IsNullOrEmpty(preprocessorDirectory)); + WaveConditionsCosineCalculationInput calculationInput = CreateInput(waterLevel, a, b, c, norm, input, calculationSettings); WaveConditionsOutput output; var exceptionThrown = false; @@ -358,14 +354,14 @@ /// The 'c' factor decided on failure mechanism level. /// The norm to use as the target. /// The input that is different per calculation. - /// The path to the hydraulic boundary database file. - /// Indicator whether to use the preprocessor in the calculation. + /// The containing all data + /// to perform a hydraulic boundary calculation. /// A . - /// Thrown when the + /// Thrown when the hydraulic boundary database file path. /// contains invalid characters. /// Thrown when: /// - /// No settings database file could be found at the location of + /// No settings database file could be found at the location of the hydraulic boundary database file path /// with the same name. /// Unable to open settings database file. /// Unable to read required data from database file. @@ -377,8 +373,7 @@ RoundedDouble c, double norm, WaveConditionsInput input, - string hydraulicBoundaryDatabaseFilePath, - bool usePreprocessor) + HydraulicBoundaryCalculationSettings calculationSettings) { var waveConditionsCosineCalculationInput = new WaveConditionsCosineCalculationInput( 1, @@ -392,7 +387,9 @@ b, c); - HydraRingSettingsDatabaseHelper.AssignSettingsFromDatabase(waveConditionsCosineCalculationInput, hydraulicBoundaryDatabaseFilePath, usePreprocessor); + HydraRingSettingsDatabaseHelper.AssignSettingsFromDatabase(waveConditionsCosineCalculationInput, + calculationSettings.HydraulicBoundaryDatabaseFilePath, + !string.IsNullOrEmpty(calculationSettings.PreprocessorDirectory)); return waveConditionsCosineCalculationInput; }