Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismAssemblyFactory.cs
===================================================================
diff -u -rbbbfacd9e38cf43c98dba73e39694850fb932a66 -r76d5e546e8087c3cd169dd2e6bb04556d88eec87
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismAssemblyFactory.cs (.../GrassCoverErosionInwardsFailureMechanismAssemblyFactory.cs) (revision bbbfacd9e38cf43c98dba73e39694850fb932a66)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismAssemblyFactory.cs (.../GrassCoverErosionInwardsFailureMechanismAssemblyFactory.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87)
@@ -25,9 +25,9 @@
using Ringtoets.AssemblyTool.KernelWrapper.Calculators;
using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Assembly;
using Ringtoets.AssemblyTool.KernelWrapper.Kernels;
+using Ringtoets.Common.Data.AssemblyTool;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Exceptions;
-using Ringtoets.Common.Primitives;
namespace Ringtoets.GrassCoverErosionInwards.Data
{
@@ -220,15 +220,13 @@
///
/// The failure mechanism to assemble for.
/// The the failure mechanism belongs to.
- /// Indicator whether the manual assembly should be used in the assembly.
/// A .
/// Thrown when any parameter is null.
/// Thrown when the
/// could not be created.
public static FailureMechanismAssembly AssembleFailureMechanism(
GrassCoverErosionInwardsFailureMechanism failureMechanism,
- IAssessmentSection assessmentSection,
- bool considerManualAssembly = true)
+ IAssessmentSection assessmentSection)
{
if (failureMechanism == null)
{
@@ -241,49 +239,76 @@
}
IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance;
+ AssemblyCategoriesInput assemblyCategoriesInput = CreateAssemblyCategoriesInput(failureMechanism, assessmentSection);
+ IEnumerable sectionAssemblies = AssembleSections(failureMechanism,
+ assessmentSection,
+ assemblyCategoriesInput);
+
+ try
+ {
+ IFailureMechanismAssemblyCalculator calculator =
+ calculatorFactory.CreateFailureMechanismAssemblyCalculator(AssemblyToolKernelFactory.Instance);
+
+ return calculator.Assemble(sectionAssemblies, assemblyCategoriesInput);
+ }
+ catch (FailureMechanismAssemblyCalculatorException e)
+ {
+ throw new AssemblyException(e.Message, e);
+ }
+ }
+
+ ///
+ /// Assembles the combined assembly for all sections in the .
+ ///
+ /// The failure mechanism to assemble for.
+ /// The the failure mechanism belongs to.
+ /// The object containing the input parameters for determining the assembly categories.
+ /// Thrown when a
+ /// could not be created.
+ /// A collection of all section assembly results.
+ private static IEnumerable AssembleSections(GrassCoverErosionInwardsFailureMechanism failureMechanism,
+ IAssessmentSection assessmentSection,
+ AssemblyCategoriesInput assemblyCategoriesInput)
+ {
+ IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance;
IFailureMechanismSectionAssemblyCalculator sectionCalculator =
calculatorFactory.CreateFailureMechanismSectionAssemblyCalculator(AssemblyToolKernelFactory.Instance);
- AssemblyCategoriesInput assemblyCategoriesInput = CreateAssemblyCategoriesInput(failureMechanism, assessmentSection);
var sectionAssemblies = new List();
- try
+ foreach (GrassCoverErosionInwardsFailureMechanismSectionResult sectionResult in failureMechanism.SectionResults)
{
- foreach (GrassCoverErosionInwardsFailureMechanismSectionResult sectionResult in failureMechanism.SectionResults)
+ FailureMechanismSectionAssembly sectionAssembly;
+ if (sectionResult.UseManualAssemblyProbability)
{
- if (sectionResult.UseManualAssemblyProbability && considerManualAssembly)
+ try
{
- sectionAssemblies.Add(sectionCalculator.AssembleDetailedAssessment(
- DetailedAssessmentProbabilityOnlyResultType.Probability,
- sectionResult.ManualAssemblyProbability,
- assemblyCategoriesInput));
+ sectionAssembly = sectionCalculator.AssembleManual(sectionResult.ManualAssemblyProbability, assemblyCategoriesInput);
}
- else
+ catch (FailureMechanismSectionAssemblyCalculatorException e)
{
- sectionAssemblies.Add(AssembleCombinedAssessment(sectionResult,
- failureMechanism,
- assessmentSection));
+ throw new AssemblyException(e.Message, e);
}
}
+ else
+ {
+ sectionAssembly = AssembleCombinedAssessment(sectionResult,
+ failureMechanism,
+ assessmentSection);
+ }
- IFailureMechanismAssemblyCalculator calculator =
- calculatorFactory.CreateFailureMechanismAssemblyCalculator(AssemblyToolKernelFactory.Instance);
-
- return calculator.Assemble(sectionAssemblies, assemblyCategoriesInput);
+ sectionAssemblies.Add(sectionAssembly);
}
- catch (Exception e) when (e is FailureMechanismAssemblyCalculatorException || e is FailureMechanismSectionAssemblyCalculatorException)
- {
- throw new AssemblyException(e.Message, e);
- }
+
+ return sectionAssemblies;
}
private static AssemblyCategoriesInput CreateAssemblyCategoriesInput(GrassCoverErosionInwardsFailureMechanism failureMechanism,
IAssessmentSection assessmentSection)
{
- return new AssemblyCategoriesInput(failureMechanism.GeneralInput.N,
- failureMechanism.Contribution,
- assessmentSection.FailureMechanismContribution.SignalingNorm,
- assessmentSection.FailureMechanismContribution.LowerLimitNorm);
+ return AssemblyCategoriesInputFactory.CreateAssemblyCategoriesInput(failureMechanism.GeneralInput.N,
+ failureMechanism,
+ assessmentSection);
}
}
}
\ No newline at end of file