Index: Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationService.cs
===================================================================
diff -u -r8bb6e849266ec28412ebfe23beccd7235c4db9bf -rec03b23520b9fbc7e2f79f2a5589bb832b510fda
--- Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationService.cs (.../DesignWaterLevelCalculationService.cs) (revision 8bb6e849266ec28412ebfe23beccd7235c4db9bf)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationService.cs (.../DesignWaterLevelCalculationService.cs) (revision ec03b23520b9fbc7e2f79f2a5589bb832b510fda)
@@ -73,11 +73,11 @@
///
/// Performs a calculation for the design water level.
///
- /// The hydraulic boundary location used in the calculation.
+ /// The design water level calculation to use.
/// The path which points to the hydraulic boundary database file.
/// The norm of the assessment section.
/// The object which is used to build log messages.
- /// Thrown when
+ /// Thrown when
/// is null.
/// Thrown when
///
@@ -92,17 +92,17 @@
/// - Unable to read required data from database file.
///
/// Thrown when an error occurs while performing the calculation.
- public void Calculate(HydraulicBoundaryLocation hydraulicBoundaryLocation,
+ public void Calculate(IDesignWaterLevelCalculation designWaterLevelCalculation,
string hydraulicBoundaryDatabaseFilePath,
double norm,
ICalculationMessageProvider messageProvider)
{
- if (hydraulicBoundaryLocation == null)
+ if (designWaterLevelCalculation == null)
{
- throw new ArgumentNullException(nameof(hydraulicBoundaryLocation));
+ throw new ArgumentNullException(nameof(designWaterLevelCalculation));
}
string hlcdDirectory = Path.GetDirectoryName(hydraulicBoundaryDatabaseFilePath);
- string calculationName = messageProvider.GetCalculationName(hydraulicBoundaryLocation.Name);
+ string calculationName = messageProvider.GetCalculationName(designWaterLevelCalculation.GetName());
CalculationServiceHelper.LogCalculationBegin(calculationName);
@@ -112,13 +112,13 @@
try
{
- AssessmentLevelCalculationInput calculationInput = CreateInput(hydraulicBoundaryLocation, norm, hydraulicBoundaryDatabaseFilePath);
+ AssessmentLevelCalculationInput calculationInput = CreateInput(designWaterLevelCalculation, norm, hydraulicBoundaryDatabaseFilePath);
calculator.Calculate(calculationInput);
- if (string.IsNullOrEmpty(calculator.LastErrorFileContent))
+ if (!canceled && string.IsNullOrEmpty(calculator.LastErrorFileContent))
{
- hydraulicBoundaryLocation.DesignWaterLevelCalculation.Output = CreateHydraulicBoundaryLocationOutput(
- messageProvider, hydraulicBoundaryLocation.Name, calculationInput.Beta, norm, calculator.Converged);
+ designWaterLevelCalculation.SetOutput(CreateHydraulicBoundaryLocationOutput(
+ messageProvider, designWaterLevelCalculation.GetName(), calculationInput.Beta, norm, calculator.Converged));
}
}
catch (HydraRingCalculationException)
@@ -127,8 +127,8 @@
{
string lastErrorContent = calculator.LastErrorFileContent;
log.Error(string.IsNullOrEmpty(lastErrorContent)
- ? messageProvider.GetCalculationFailedUnexplainedMessage(hydraulicBoundaryLocation.Name)
- : messageProvider.GetCalculationFailedMessage(hydraulicBoundaryLocation.Name, lastErrorContent));
+ ? messageProvider.GetCalculationFailedUnexplainedMessage(designWaterLevelCalculation.GetName())
+ : messageProvider.GetCalculationFailedMessage(designWaterLevelCalculation.GetName(), lastErrorContent));
exceptionThrown = true;
throw;
@@ -140,7 +140,7 @@
bool errorOccurred = CalculationServiceHelper.HasErrorOccurred(canceled, exceptionThrown, lastErrorFileContent);
if (errorOccurred)
{
- log.Error(messageProvider.GetCalculationFailedMessage(hydraulicBoundaryLocation.Name, lastErrorFileContent));
+ log.Error(messageProvider.GetCalculationFailedMessage(designWaterLevelCalculation.GetName(), lastErrorFileContent));
}
log.InfoFormat(Resources.DesignWaterLevelCalculationService_Calculate_Calculation_temporary_directory_can_be_found_on_location_0, calculator.OutputDirectory);
@@ -197,9 +197,9 @@
}
///
- /// Creates the input for a wave height calculation.
+ /// Creates the input for a design water level calculation.
///
- /// The
+ /// The
/// to create the input from.
/// The norm to use during the calculation.
/// The file path to the hydraulic
@@ -215,11 +215,11 @@
/// - Unable to read required data from database file.
///
///
- private static AssessmentLevelCalculationInput CreateInput(HydraulicBoundaryLocation hydraulicBoundaryLocation,
+ private static AssessmentLevelCalculationInput CreateInput(IDesignWaterLevelCalculation designWaterLevelCalculation,
double norm,
string hydraulicBoundaryDatabaseFilePath)
{
- var assessmentLevelCalculationInput = new AssessmentLevelCalculationInput(1, hydraulicBoundaryLocation.Id, norm);
+ var assessmentLevelCalculationInput = new AssessmentLevelCalculationInput(1, designWaterLevelCalculation.GetId(), norm);
HydraRingSettingsDatabaseHelper.AssignSettingsFromDatabase(assessmentLevelCalculationInput, hydraulicBoundaryDatabaseFilePath);