using System;
using Deltares.DamEngine.Calculators.KernelWrappers.DamMacroStabilityInwards;
using Deltares.DamEngine.Calculators.KernelWrappers.DamMacroStabilityOutwards;
using Deltares.DamEngine.Calculators.KernelWrappers.DamPipingBligh;
using Deltares.DamEngine.Calculators.KernelWrappers.DamPipingSellmeijer4Forces;
using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces;
using Deltares.DamEngine.Calculators.Properties;
using Deltares.DamEngine.Data.General;
namespace Deltares.DamEngine.Calculators.KernelWrappers.Common
{
public class KernelWrapperHelper
{
///
/// Creates the kernel wrapper.
/// Everything that is non-generic and failure mechanism specific should be put here
///
/// The current failure mechanism specification.
///
///
///
public static IKernelWrapper CreateKernelWrapper(DamFailureMechanismeCalculationSpecification currentSpecification)
{
IKernelWrapper kernelWrapper = null;
switch (currentSpecification.FailureMechanismSystemType)
{
case FailureMechanismSystemType.HorizontalBalance:
throw new NotImplementedException(Resources.DesignCalculatorKernelNotImplemented);
case FailureMechanismSystemType.StabilityOutside:
kernelWrapper = new DamMacroStabilityOutwardsKernelWrapper();
var damMacroStabilityOutwardsKernelWrapper = (DamMacroStabilityOutwardsKernelWrapper)kernelWrapper;
damMacroStabilityOutwardsKernelWrapper.FailureMechanismParametersMStab = currentSpecification.FailureMechanismParametersMStab;
break;
case FailureMechanismSystemType.StabilityInside:
kernelWrapper = new DamMacroStabilityInwardsKernelWrapper();
var damMacroStabilityKernelWrapper = (DamMacroStabilityInwardsKernelWrapper)kernelWrapper;
damMacroStabilityKernelWrapper.FailureMechanismParametersMStab = currentSpecification.FailureMechanismParametersMStab;
break;
case FailureMechanismSystemType.Piping:
switch (currentSpecification.PipingModelType)
{
case PipingModelType.SellmeijerVnk:
case PipingModelType.Wti2017:
throw new NotImplementedException(Resources.DesignCalculatorKernelNotImplemented);
case PipingModelType.Bligh:
kernelWrapper = new DamPipingBlighKernelWrapper();
break;
case PipingModelType.Sellmeijer4Forces:
kernelWrapper = new DamPipingSellmeijer4ForcesKernelWrapper();
break;
}
break;
}
return kernelWrapper;
}
}
}