Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneLocationCalculationService.cs =================================================================== diff -u -r04f52eadd43dc86d9ce0646a932ce72303015f24 -r8fa62efd9d2a32aef893660a60e8f7ac12fc78bf --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneLocationCalculationService.cs (.../DuneLocationCalculationService.cs) (revision 04f52eadd43dc86d9ce0646a932ce72303015f24) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneLocationCalculationService.cs (.../DuneLocationCalculationService.cs) (revision 8fa62efd9d2a32aef893660a60e8f7ac12fc78bf) @@ -20,7 +20,6 @@ // All rights reserved. using System; -using System.IO; using Core.Common.Base.IO; using Core.Common.Util; using log4net; @@ -53,23 +52,22 @@ /// /// The to perform. /// The norm to use during the calculation. - /// The path which points to the hydraulic - /// boundary database file. - /// The preprocessor directory. + /// The containing all data + /// to perform a hydraulic boundary calculation. /// The object which is used to build log messages. - /// Preprocessing is disabled when equals . - /// Thrown when or - /// is null. + /// Preprocessing is disabled when the preprocessor directory equals . + /// Thrown when , + /// or is null. /// Thrown when: /// - /// The contains invalid characters. + /// The hydraulic boundary location database file path contains invalid characters. /// The contribution of the failure mechanism is zero. /// The target probability or the calculated probability falls outside the [0.0, 1.0] /// range and is not . /// /// 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 /// with the same name. /// Unable to open settings database file. /// Unable to read required data from database file. @@ -78,15 +76,19 @@ /// the calculation. public void Calculate(DuneLocationCalculation duneLocationCalculation, double norm, - string hydraulicBoundaryDatabaseFilePath, - string preprocessorDirectory, + HydraulicBoundaryCalculationSettings calculationSettings, ICalculationMessageProvider messageProvider) { if (duneLocationCalculation == null) { throw new ArgumentNullException(nameof(duneLocationCalculation)); } + if (calculationSettings == null) + { + throw new ArgumentNullException(nameof(calculationSettings)); + } + if (messageProvider == null) { throw new ArgumentNullException(nameof(messageProvider)); @@ -97,17 +99,16 @@ CalculationServiceHelper.LogCalculationBegin(); - var settings = new HydraRingCalculationSettings(hydraulicBoundaryDatabaseFilePath, preprocessorDirectory); - calculator = HydraRingCalculatorFactory.Instance.CreateDunesBoundaryConditionsCalculator(settings); + HydraRingCalculationSettings hydraRingCalculationSettings = HydraRingCalculationSettingsFactory.CreateSettings(calculationSettings); + calculator = HydraRingCalculatorFactory.Instance.CreateDunesBoundaryConditionsCalculator(hydraRingCalculationSettings); var exceptionThrown = false; try { DunesBoundaryConditionsCalculationInput calculationInput = CreateInput(duneLocation, norm, - hydraulicBoundaryDatabaseFilePath, - !string.IsNullOrEmpty(preprocessorDirectory)); + calculationSettings); calculator.Calculate(calculationInput); if (string.IsNullOrEmpty(calculator.LastErrorFileContent)) @@ -203,28 +204,28 @@ /// /// The to create the input for. /// The norm of the failure mechanism to use. - /// The file path to the hydraulic - /// boundary database. - /// Indicator whether to use the preprocessor in the calculation. + /// The containing + /// all data to perform a hydraulic boundary calculation. /// A with all needed /// input data. - /// 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. /// /// private static DunesBoundaryConditionsCalculationInput CreateInput(DuneLocation duneLocation, double norm, - string hydraulicBoundaryDatabaseFilePath, - bool usePreprocessor) + HydraulicBoundaryCalculationSettings calculationSettings) { var dunesBoundaryConditionsCalculationInput = new DunesBoundaryConditionsCalculationInput(1, duneLocation.Id, norm); - HydraRingSettingsDatabaseHelper.AssignSettingsFromDatabase(dunesBoundaryConditionsCalculationInput, hydraulicBoundaryDatabaseFilePath, usePreprocessor); + HydraRingSettingsDatabaseHelper.AssignSettingsFromDatabase(dunesBoundaryConditionsCalculationInput, + calculationSettings.HydraulicBoundaryDatabaseFilePath, + !string.IsNullOrEmpty(calculationSettings.PreprocessorDirectory)); return dunesBoundaryConditionsCalculationInput; } }