// Copyright (C) Stichting Deltares 2017. All rights reserved.
//
// This file is part of Ringtoets.
//
// Ringtoets is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
//
// All names, logos, and references to "Deltares" are registered trademarks of
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
using System.Collections.Generic;
using Ringtoets.AssemblyTool.Data;
using Ringtoets.AssemblyTool.KernelWrapper.Calculators;
using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories;
using Ringtoets.AssemblyTool.KernelWrapper.Kernels;
using Ringtoets.Common.Data.Exceptions;
namespace Ringtoets.Common.Data.AssemblyTool
{
///
/// Factory for calculating the assembly tool categories.
///
public static class AssemblyToolCategoriesFactory
{
///
/// Creates the assessment section assembly categories.
///
/// The signaling norm to use in the calculation.
/// The lower limit norm to use in the calculation.
/// An of .
/// Thrown when an error occurred while creating the categories.
public static IEnumerable CreateAssessmentSectionAssemblyCategories(double signalingNorm, double lowerLimitNorm)
{
IAssemblyCategoriesCalculator calculator = AssemblyToolCalculatorFactory.Instance.CreateAssemblyCategoriesCalculator(
AssemblyToolKernelFactory.Instance);
try
{
return calculator.CalculateAssessmentSectionCategories(signalingNorm, lowerLimitNorm);
}
catch (AssemblyCategoriesCalculatorException e)
{
throw new AssemblyException(e.Message, e);
}
}
///
/// Creates the failure mechanism assembly categories.
///
/// The signaling norm to use in the calculation.
/// The lower limit norm to use in the calculation.
/// The failure mechanism contribution to calculate with.
/// The 'N' parameter used to factor in the 'length effect'.
/// An with categories of
/// .
/// Thrown when an error occurred while creating the categories.
public static IEnumerable CreateFailureMechanismAssemblyCategories(
double signalingNorm,
double lowerLimitNorm,
double failureMechanismContribution,
double n)
{
IAssemblyCategoriesCalculator calculator = AssemblyToolCalculatorFactory.Instance.CreateAssemblyCategoriesCalculator(
AssemblyToolKernelFactory.Instance);
try
{
return calculator.CalculateFailureMechanismCategories(new AssemblyCategoriesInput(
n, failureMechanismContribution / 100,
signalingNorm, lowerLimitNorm));
}
catch (AssemblyCategoriesCalculatorException e)
{
throw new AssemblyException(e.Message, e);
}
}
///
/// Creates the failure mechanism section assembly categories.
///
/// The signaling norm to use in the calculation.
/// The lower limit norm to use in the calculation.
/// The failure mechanism contribution to calculate with.
/// The 'N' parameter used to factor in the 'length effect'.
/// An with categories of
/// .
/// Thrown when an error occurred while creating the categories.
public static IEnumerable CreateFailureMechanismSectionAssemblyCategories(
double signalingNorm,
double lowerLimitNorm,
double failureMechanismContribution,
double n)
{
IAssemblyCategoriesCalculator calculator = AssemblyToolCalculatorFactory.Instance.CreateAssemblyCategoriesCalculator(
AssemblyToolKernelFactory.Instance);
try
{
return calculator.CalculateFailureMechanismSectionCategories(new AssemblyCategoriesInput(
n, failureMechanismContribution / 100,
signalingNorm, lowerLimitNorm));
}
catch (AssemblyCategoriesCalculatorException e)
{
throw new AssemblyException(e.Message, e);
}
}
///
/// Creates the geotechnical failure mechanism section assembly categories.
///
/// The norm to use in the calculation.
/// The failure mechanism contribution to calculate with.
/// The 'N' parameter used to factor in the 'length effect'.
/// An with categories of
/// .
/// Thrown when an error occurred while creating the categories.
public static IEnumerable CreateGeotechnicalFailureMechanismSectionAssemblyCategories(
double normativeNorm,
double failureMechanismContribution,
double n)
{
IAssemblyCategoriesCalculator calculator = AssemblyToolCalculatorFactory.Instance.CreateAssemblyCategoriesCalculator(
AssemblyToolKernelFactory.Instance);
try
{
return calculator.CalculateGeotechnicalFailureMechanismSectionCategories(normativeNorm,
n,
failureMechanismContribution / 100);
}
catch (AssemblyCategoriesCalculatorException e)
{
throw new AssemblyException(e.Message, e);
}
}
}
}