Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresCalculationService.cs
===================================================================
diff -u -r6e0a4fb94b3cd5631842025c95d2b1460fc7a6ce -rf71fb2faaae836236b85a1c3a4483f6aee4f4d88
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresCalculationService.cs (.../HeightStructuresCalculationService.cs) (revision 6e0a4fb94b3cd5631842025c95d2b1460fc7a6ce)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresCalculationService.cs (.../HeightStructuresCalculationService.cs) (revision f71fb2faaae836236b85a1c3a4483f6aee4f4d88)
@@ -19,40 +19,30 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using log4net;
-using Ringtoets.Common.Data.AssessmentSection;
-using Ringtoets.Common.Data.Probability;
using Ringtoets.Common.Data.Structures;
using Ringtoets.Common.Service;
-using Ringtoets.Common.Service.MessageProviders;
using Ringtoets.Common.Service.Structures;
using Ringtoets.HeightStructures.Data;
-using Ringtoets.HeightStructures.Service.Properties;
-using Ringtoets.HydraRing.Calculation.Calculator;
using Ringtoets.HydraRing.Calculation.Data.Input.Structures;
-using Ringtoets.HydraRing.Calculation.Exceptions;
namespace Ringtoets.HeightStructures.Service
{
///
/// Service that provides methods for performing Hydra-Ring calculations for height structures.
///
public class HeightStructuresCalculationService : StructuresCalculationServiceBase
- {
- private static readonly ILog log = LogManager.GetLogger(typeof(HeightStructuresCalculationService));
+ HeightStructure, GeneralHeightStructuresInput, StructuresOvertoppingCalculationInput>
+ {
///
/// Creates a new instance of .
///
public HeightStructuresCalculationService() : base(new HeightStructuresCalculationMessageProvider()) {}
protected override StructuresOvertoppingCalculationInput CreateInput(StructuresCalculation calculation,
- HeightStructuresFailureMechanism failureMechanism,
+ GeneralHeightStructuresInput generalInput,
string hydraulicBoundaryDatabaseFilePath)
{
- GeneralHeightStructuresInput generalInput = failureMechanism.GeneralInput;
-
var structuresOvertoppingCalculationInput = new StructuresOvertoppingCalculationInput(
calculation.InputParameters.HydraulicBoundaryLocation.Id,
calculation.InputParameters.StructureNormalOrientation,
@@ -78,67 +68,5 @@
return structuresOvertoppingCalculationInput;
}
-
- protected override void PerformCalculation(IStructuresCalculator calculator,
- StructuresOvertoppingCalculationInput input,
- StructuresCalculation calculation,
- IAssessmentSection assessmentSection,
- HeightStructuresFailureMechanism failureMechanism)
- {
- var exceptionThrown = false;
-
- try
- {
- calculator.Calculate(input);
-
- if (!Canceled && string.IsNullOrEmpty(calculator.LastErrorFileContent))
- {
- ProbabilityAssessmentOutput probabilityAssessmentOutput =
- ProbabilityAssessmentService.Calculate(assessmentSection.FailureMechanismContribution.Norm,
- failureMechanism.Contribution,
- failureMechanism.GeneralInput.N,
- calculator.ExceedanceProbabilityBeta);
- calculation.Output = new StructuresOutput(probabilityAssessmentOutput);
- }
- }
- catch (HydraRingCalculationException)
- {
- if (!Canceled)
- {
- string lastErrorContent = calculator.LastErrorFileContent;
- if (string.IsNullOrEmpty(lastErrorContent))
- {
- log.ErrorFormat(Resources.HeightStructuresCalculationService_Calculate_Error_in_HeightStructuresCalculation_0_no_error_report,
- calculation.Name);
- }
- else
- {
- log.ErrorFormat(Resources.HeightStructuresCalculationService_Calculate_Error_in_HeightStructuresCalculation_0_click_details_for_last_error_report_1,
- calculation.Name, lastErrorContent);
- }
-
- exceptionThrown = true;
- throw;
- }
- }
- finally
- {
- string lastErrorFileContent = calculator.LastErrorFileContent;
- bool errorOccurred = CalculationServiceHelper.HasErrorOccurred(Canceled, exceptionThrown, lastErrorFileContent);
- if (errorOccurred)
- {
- log.ErrorFormat(Resources.HeightStructuresCalculationService_Calculate_Error_in_HeightStructuresCalculation_0_click_details_for_last_error_report_1,
- calculation.Name, lastErrorFileContent);
- }
-
- log.InfoFormat(Resources.HeightStructuresCalculationService_Calculate_Calculation_temporary_directory_can_be_found_on_location_0, calculator.OutputDirectory);
- CalculationServiceHelper.LogCalculationEnd();
-
- if (errorOccurred)
- {
- throw new HydraRingCalculationException(lastErrorFileContent);
- }
- }
- }
}
}
\ No newline at end of file