Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneLocationCalculationService.cs
===================================================================
diff -u -rd8d8428e2723f189605f0065a2cddcc3f9f9eaef -rdd347e5ef5916532cce1004e1941e8523ec448b4
--- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneLocationCalculationService.cs (.../DuneLocationCalculationService.cs) (revision d8d8428e2723f189605f0065a2cddcc3f9f9eaef)
+++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneLocationCalculationService.cs (.../DuneLocationCalculationService.cs) (revision dd347e5ef5916532cce1004e1941e8523ec448b4)
@@ -1,4 +1,4 @@
-// Copyright (C) Stichting Deltares 2017. All rights reserved.
+// Copyright (C) Stichting Deltares 2018. All rights reserved.
//
// This file is part of Ringtoets.
//
@@ -20,7 +20,6 @@
// All rights reserved.
using System;
-using System.IO;
using Core.Common.Base.IO;
using Core.Common.Util;
using log4net;
@@ -29,10 +28,11 @@
using Ringtoets.Common.Service.MessageProviders;
using Ringtoets.DuneErosion.Data;
using Ringtoets.DuneErosion.Service.Properties;
-using Ringtoets.HydraRing.Calculation.Calculator;
-using Ringtoets.HydraRing.Calculation.Calculator.Factory;
-using Ringtoets.HydraRing.Calculation.Data.Input.Hydraulics;
-using Ringtoets.HydraRing.Calculation.Exceptions;
+using Riskeer.HydraRing.Calculation.Calculator;
+using Riskeer.HydraRing.Calculation.Calculator.Factory;
+using Riskeer.HydraRing.Calculation.Data.Input;
+using Riskeer.HydraRing.Calculation.Data.Input.Hydraulics;
+using Riskeer.HydraRing.Calculation.Exceptions;
namespace Ringtoets.DuneErosion.Service
{
@@ -52,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 with the
+ /// hydraulic boundary calculation settings.
/// 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.
@@ -77,37 +76,39 @@
/// 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));
}
- string hlcdDirectory = Path.GetDirectoryName(hydraulicBoundaryDatabaseFilePath);
-
DuneLocation duneLocation = duneLocationCalculation.DuneLocation;
string duneLocationName = duneLocation.Name;
CalculationServiceHelper.LogCalculationBegin();
- calculator = HydraRingCalculatorFactory.Instance.CreateDunesBoundaryConditionsCalculator(hlcdDirectory, preprocessorDirectory);
+ 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 with the
+ /// hydraulic boundary calculation settings.
/// 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;
}
}