Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneErosionBoundaryCalculationService.cs
===================================================================
diff -u -rf4f041e353f89e0e93a4243968acee599b2186a7 -rb4ed912781c24bc513aa9898d3a50ee68b6f8179
--- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneErosionBoundaryCalculationService.cs (.../DuneErosionBoundaryCalculationService.cs) (revision f4f041e353f89e0e93a4243968acee599b2186a7)
+++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneErosionBoundaryCalculationService.cs (.../DuneErosionBoundaryCalculationService.cs) (revision b4ed912781c24bc513aa9898d3a50ee68b6f8179)
@@ -24,7 +24,6 @@
using Core.Common.IO.Exceptions;
using Core.Common.Utils;
using log4net;
-using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Common.Service;
using Ringtoets.DuneErosion.Data;
@@ -52,14 +51,16 @@
/// Error and status information is logged during the execution of the operation.
///
/// The that holds information required to perform the calculation.
- /// The that holds information about the contribution and
+ /// The that holds information about the contribution and
/// the general inputs used in the calculation.
- /// The that holds information about the norm used in the calculation.
+ /// The id of the assessment section.
+ /// The norm of the assessment section.
/// The path which points to the hydraulic boundary database file.
/// Thrown when:
///
/// - The contains invalid characters.
/// - The contribution of the failure mechanism is zero.
+ /// - The target propability or the calculated propability falls outside the [0.0, 1.0] range and is not .
///
/// Thrown when:
///
@@ -73,17 +74,18 @@
/// Thrown when an error occurs during the calculation.
public void Calculate(DuneLocation duneLocation,
DuneErosionFailureMechanism failureMechanism,
- IAssessmentSection assessmentSection,
+ string ringId,
+ double norm,
string hydraulicBoundaryDatabaseFilePath)
{
string hlcdDirectory = Path.GetDirectoryName(hydraulicBoundaryDatabaseFilePath);
- calculator = HydraRingCalculatorFactory.Instance.CreateDunesBoundaryConditionsCalculator(hlcdDirectory, assessmentSection.Id);
+ calculator = HydraRingCalculatorFactory.Instance.CreateDunesBoundaryConditionsCalculator(hlcdDirectory, ringId);
string calculationName = duneLocation.Name;
CalculationServiceHelper.LogCalculationBeginTime(calculationName);
- var mechanismSpecificNorm = GetFailureMechanismSpecificNorm(failureMechanism, assessmentSection, calculationName);
+ var mechanismSpecificNorm = GetFailureMechanismSpecificNorm(failureMechanism, norm, calculationName);
var exceptionThrown = false;
try
@@ -125,7 +127,7 @@
log.ErrorFormat(Resources.DuneErosionBoundaryCalculationService_Calculate_Error_in_dune_erosion_0_calculation_click_details_for_last_error_report_1,
calculationName, lastErrorFileContent);
}
-
+
FinalizeCalculation(calculationName, true);
if (hasErrorOccurred)
@@ -136,14 +138,29 @@
}
///
+ /// Cancels any ongoing dune erosion calculation.
+ ///
+ public void Cancel()
+ {
+ if (calculator != null)
+ {
+ calculator.Cancel();
+ }
+
+ canceled = true;
+ }
+
+ ///
/// Get the specific norm of the .
///
/// The failure mechanism to get the norm for.
- /// The assessment section to get the norm fequency from.
+ /// The assessment section norm.
/// The name of the calculation.
/// The failure mechanism specific norm.
/// Thrown when the contribution of the failure mechanism is zero.
- private double GetFailureMechanismSpecificNorm(DuneErosionFailureMechanism failureMechanism, IAssessmentSection assessmentSection, string calculationName)
+ private double GetFailureMechanismSpecificNorm(DuneErosionFailureMechanism failureMechanism,
+ double assessmentSectionNorm,
+ string calculationName)
{
if (Math.Abs(failureMechanism.Contribution) < 1e-6)
{
@@ -153,31 +170,28 @@
throw new ArgumentException(errorMessage);
}
- return failureMechanism.GetMechanismSpecificNorm(assessmentSection);
+ return failureMechanism.GetMechanismSpecificNorm(assessmentSectionNorm);
}
private void FinalizeCalculation(string calculationName, bool calculationExecuted)
{
if (calculationExecuted)
{
- log.InfoFormat(Resources.DuneErosionBoundaryCalculationService_Calculate_Calculation_temporary_directory_can_be_found_on_location_0, calculator.OutputDirectory);
+ log.InfoFormat(Resources.DuneErosionBoundaryCalculationService_Calculate_Calculation_temporary_directory_can_be_found_on_location_0,
+ calculator.OutputDirectory);
}
CalculationServiceHelper.LogCalculationEndTime(calculationName);
}
///
- /// Cancels any ongoing dune erosion calculation.
+ /// Create the output of the calculation.
///
- public void Cancel()
- {
- if (calculator != null)
- {
- calculator.Cancel();
- }
-
- canceled = true;
- }
-
+ /// The name of the location.
+ /// The target reliability for the calculation.
+ /// The target probability for the calculation.
+ /// A .
+ /// Thrown when
+ /// or the calculated propability falls outside the [0.0, 1.0] range and is not .
private DuneLocationOutput CreateDuneLocationOutput(string duneLocationName, double targetReliability, double targetProbability)
{
double reliability = calculator.ReliabilityIndex;