Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Data/GrassCoverErosionOutwardsFailureMechanismExtensions.cs
===================================================================
diff -u -r1e14ee40087ad0c42f889f6ee86c13bf6d7d192b -r5d0dfa9a8b6e98ede2791a93ed50d48ce6ada072
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Data/GrassCoverErosionOutwardsFailureMechanismExtensions.cs (.../GrassCoverErosionOutwardsFailureMechanismExtensions.cs) (revision 1e14ee40087ad0c42f889f6ee86c13bf6d7d192b)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Data/GrassCoverErosionOutwardsFailureMechanismExtensions.cs (.../GrassCoverErosionOutwardsFailureMechanismExtensions.cs) (revision 5d0dfa9a8b6e98ede2791a93ed50d48ce6ada072)
@@ -24,6 +24,8 @@
using System.ComponentModel;
using System.Linq;
using Core.Common.Base.Data;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Common.Data.AssemblyTool;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Common.Data.Hydraulics;
@@ -38,8 +40,8 @@
///
/// Gets the assessment level for a based on .
///
- /// The assessment section to get the assessment level from.
/// The failure mechanism to get the assessment level from.
+ /// The assessment section to get the assessment level from.
/// The hydraulic boundary location to get the assessment level for.
/// The category type to use while obtaining the assessment level.
/// The assessment level or when:
@@ -104,6 +106,68 @@
return GetAssessmentLevelFromCalculations(hydraulicBoundaryLocation, calculations);
}
+ ///
+ /// Gets the norm based on .
+ ///
+ /// The failure mechanism to get the norm from.
+ /// The assessment section to get the norm from.
+ /// The category type to use while obtaining the norm.
+ /// The norm corresponding to the provided category type.
+ /// Thrown when
+ /// or is null.
+ /// Thrown when
+ /// is an invalid .
+ /// Thrown when
+ /// is a valid but unsupported .
+ public static double GetNorm(this GrassCoverErosionOutwardsFailureMechanism failureMechanism,
+ IAssessmentSection assessmentSection,
+ FailureMechanismCategoryType categoryType)
+ {
+ if (failureMechanism == null)
+ {
+ throw new ArgumentNullException(nameof(failureMechanism));
+ }
+
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ if (!Enum.IsDefined(typeof(FailureMechanismCategoryType), categoryType))
+ {
+ throw new InvalidEnumArgumentException(nameof(categoryType),
+ (int) categoryType,
+ typeof(FailureMechanismCategoryType));
+ }
+
+ IEnumerable categories = AssemblyToolCategoriesFactory.CreateFailureMechanismSectionAssemblyCategories(
+ assessmentSection.FailureMechanismContribution.SignalingNorm,
+ assessmentSection.FailureMechanismContribution.LowerLimitNorm,
+ failureMechanism.Contribution,
+ failureMechanism.GeneralInput.N);
+
+ switch (categoryType)
+ {
+ case FailureMechanismCategoryType.MechanismSpecificFactorizedSignalingNorm:
+ return categories.First(c => c.Group == FailureMechanismSectionAssemblyCategoryGroup.IIv)
+ .LowerBoundary;
+ case FailureMechanismCategoryType.MechanismSpecificSignalingNorm:
+ return categories.First(c => c.Group == FailureMechanismSectionAssemblyCategoryGroup.IIIv)
+ .LowerBoundary;
+ case FailureMechanismCategoryType.MechanismSpecificLowerLimitNorm:
+ return categories.First(c => c.Group == FailureMechanismSectionAssemblyCategoryGroup.IVv)
+ .LowerBoundary;
+ case FailureMechanismCategoryType.LowerLimitNorm:
+ return categories.First(c => c.Group == FailureMechanismSectionAssemblyCategoryGroup.Vv)
+ .LowerBoundary;
+ case FailureMechanismCategoryType.FactorizedLowerLimitNorm:
+ return categories.First(c => c.Group == FailureMechanismSectionAssemblyCategoryGroup.VIv)
+ .LowerBoundary;
+ default:
+ throw new NotSupportedException();
+ }
+ }
+
private static RoundedDouble GetAssessmentLevelFromCalculations(HydraulicBoundaryLocation hydraulicBoundaryLocation,
IEnumerable calculations)
{