// Copyright (C) Stichting Deltares 2016. 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 Core.Common.Base.Data;
using Ringtoets.Piping.KernelWrapper;
using Ringtoets.Piping.KernelWrapper.SubCalculator;
using Ringtoets.Piping.Primitives;
namespace Ringtoets.Piping.InputParameterCalculation
{
///
/// This class can be used to calculate input parameters for a piping calculation based on other input parameters.
///
public static class InputParameterCalculationService
{
///
/// Calculates the thickness of the coverage layer based on the values of partial piping input.
///
/// The volumetric weight of water.
/// The design value of the phreatic level at the exit point.
/// The l-coordinate of the exit point.
/// A surface line.
/// A soil profile.
/// The thickness of the coverage layer, or if the thickness could not be calculated.
public static double CalculateEffectiveThicknessCoverageLayer(double waterVolumetricWeight, RoundedDouble phreaticLevelExit, RoundedDouble exitPointL, RingtoetsPipingSurfaceLine surfaceLine, PipingSoilProfile soilProfile)
{
try
{
var calculatorInput = new PipingCalculatorInput(
waterVolumetricWeight,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
phreaticLevelExit,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
exitPointL,
surfaceLine,
soilProfile
);
return new PipingCalculator(calculatorInput, PipingSubCalculatorFactory.Instance).CalculateEffectiveThicknessCoverageLayer();
}
catch (PipingCalculatorException)
{
return double.NaN;
}
}
///
/// Calculates the piezometric head at the exit point based on the values of partial piping input.
///
/// The assessment level.
/// The design value of the damping factor at exit point.
/// The design value of the phreatic level at exit point.
/// The piezometric head at the exit point.
public static double CalculatePiezometricHeadAtExit(RoundedDouble assessmentLevel, RoundedDouble dampingFactorExit, RoundedDouble phreaticLevelExit)
{
var calculatorInput = new PipingCalculatorInput(
double.NaN,
double.NaN,
double.NaN,
assessmentLevel,
double.NaN,
dampingFactorExit,
phreaticLevelExit,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
double.NaN,
null,
null
);
return new PipingCalculator(calculatorInput, PipingSubCalculatorFactory.Instance).CalculatePiezometricHeadAtExit();
}
}
}