Index: Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/PercentileBasedDesignVariable.cs
===================================================================
diff -u -r1df1e9ae0057dde85489929cbf85d222c26e8c5f -r8b07dff41637bfd485f412ec534f2ddd7fe27c00
--- Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/PercentileBasedDesignVariable.cs (.../PercentileBasedDesignVariable.cs) (revision 1df1e9ae0057dde85489929cbf85d222c26e8c5f)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/PercentileBasedDesignVariable.cs (.../PercentileBasedDesignVariable.cs) (revision 8b07dff41637bfd485f412ec534f2ddd7fe27c00)
@@ -23,7 +23,6 @@
using System.Globalization;
using Core.Common.Base;
using Core.Common.Base.Data;
-using MathNet.Numerics.Distributions;
using Ringtoets.Common.Data.Properties;
namespace Ringtoets.Common.Data.Probabilistics
@@ -72,20 +71,5 @@
percentile = value;
}
}
-
- ///
- /// Determines the design value based on a 'normal space' expected value and standard deviation.
- ///
- /// The expected value.
- /// The standard deviation.
- /// The design value
- protected double DetermineDesignValue(double expectedValue, double standardDeviation)
- {
- // Design factor is determined using the 'probit function', which is the inverse
- // CDF function of the standard normal distribution. For more information see:
- // "Quantile function" https://en.wikipedia.org/wiki/Normal_distribution
- double designFactor = Normal.InvCDF(0.0, 1.0, Percentile);
- return expectedValue + designFactor * standardDeviation;
- }
}
}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/DerivedPipingInput.cs
===================================================================
diff -u -rf817bfc2122cfa0a48bd19ad8518a948dfd7c95c -r8b07dff41637bfd485f412ec534f2ddd7fe27c00
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/DerivedPipingInput.cs (.../DerivedPipingInput.cs) (revision f817bfc2122cfa0a48bd19ad8518a948dfd7c95c)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/DerivedPipingInput.cs (.../DerivedPipingInput.cs) (revision 8b07dff41637bfd485f412ec534f2ddd7fe27c00)
@@ -35,7 +35,7 @@
///
public class DerivedPipingInput
{
- private const double seepageLengthStandardDeviationFraction = 0.1;
+ private const double seepageLengthCoefficientOfVariation = 0.1;
private readonly PipingInput input;
@@ -82,7 +82,7 @@
double seepageLengthMean = input.ExitPointL - input.EntryPointL;
seepageLength.Mean = (RoundedDouble) seepageLengthMean;
- seepageLength.CoefficientOfVariation = (RoundedDouble) seepageLengthStandardDeviationFraction;
+ seepageLength.CoefficientOfVariation = (RoundedDouble) seepageLengthCoefficientOfVariation;
return seepageLength;
}
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/DerivedPipingInputTest.cs
===================================================================
diff -u -rf817bfc2122cfa0a48bd19ad8518a948dfd7c95c -r8b07dff41637bfd485f412ec534f2ddd7fe27c00
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/DerivedPipingInputTest.cs (.../DerivedPipingInputTest.cs) (revision f817bfc2122cfa0a48bd19ad8518a948dfd7c95c)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/DerivedPipingInputTest.cs (.../DerivedPipingInputTest.cs) (revision 8b07dff41637bfd485f412ec534f2ddd7fe27c00)
@@ -488,7 +488,7 @@
public void ThicknessAquiferLayer_SoilProfileSingleAquiferUnderSurfaceLine_ReturnMeanExpectedThicknessAquiferLayer()
{
// Setup
- PipingInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ PipingInput input = PipingInputFactory.CreateInputWithAquifer();
var derivedInput = new DerivedPipingInput(input);
// Call
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs
===================================================================
diff -u -rf817bfc2122cfa0a48bd19ad8518a948dfd7c95c -r8b07dff41637bfd485f412ec534f2ddd7fe27c00
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs (.../PipingInputTest.cs) (revision f817bfc2122cfa0a48bd19ad8518a948dfd7c95c)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs (.../PipingInputTest.cs) (revision 8b07dff41637bfd485f412ec534f2ddd7fe27c00)
@@ -707,7 +707,7 @@
LogNormalDistribution thicknessAquiferLayer = input.ThicknessAquiferLayer;
// Assert
- Assert.AreEqual(expectedThickness, thicknessAquiferLayer.Mean, 1e-6);
+ Assert.AreEqual(expectedThickness, thicknessAquiferLayer.Mean);
}
[Test]
@@ -751,7 +751,7 @@
public void ThicknessAquiferLayer_SoilProfileSingleAquiferUnderSurfaceLine_ThicknessAquiferLayerMeanSet()
{
// Setup
- PipingInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ PipingInput input = PipingInputFactory.CreateInputWithAquifer();
// Call
LogNormalDistribution thicknessAquiferLayer = input.ThicknessAquiferLayer;
@@ -771,7 +771,7 @@
LogNormalDistribution thicknessAquiferLayer = input.ThicknessAquiferLayer;
// Assert
- Assert.AreEqual(expectedThickness, thicknessAquiferLayer.Mean, 1e-6);
+ Assert.AreEqual(expectedThickness, thicknessAquiferLayer.Mean);
}
[Test]
@@ -840,7 +840,7 @@
LogNormalDistribution thicknessAquiferLayer = input.ThicknessAquiferLayer;
// Assert
- Assert.AreEqual(2.0, thicknessAquiferLayer.Mean, 1e-6);
+ Assert.AreEqual(2.0, thicknessAquiferLayer.Mean);
}
[Test]
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil.Test/PipingInputFactoryTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil.Test/PipingInputFactoryTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil.Test/PipingInputFactoryTest.cs (revision 8b07dff41637bfd485f412ec534f2ddd7fe27c00)
@@ -0,0 +1,168 @@
+// 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 System.Linq;
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.Piping.Primitives;
+
+namespace Ringtoets.Piping.Data.TestUtil.Test
+{
+ [TestFixture]
+ public class PipingInputFactoryTest
+ {
+ [Test]
+ public void CreateInputWithAquiferAndCoverageLayer_WithoutInputs_ExpectedValues()
+ {
+ // Call
+ PipingInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+
+ // Assert
+ Assert.AreEqual(0.5, input.ExitPointL);
+ Assert.AreEqual(new[]
+ {
+ new Point2D(0, 2.0),
+ new Point2D(1.0, 2.0)
+ }, input.SurfaceLine.LocalGeometry);
+ PipingSoilProfile profile = input.StochasticSoilProfile.SoilProfile;
+ Assert.AreEqual(-1.0, profile.Bottom);
+ Assert.AreEqual(2, profile.Layers.Count());
+ AssertLayer(false, 2.0, profile.Layers.ElementAt(0));
+ AssertLayer(true, 0.0, profile.Layers.ElementAt(1));
+ }
+
+ [Test]
+ [TestCase(2.0, 3.0)]
+ [TestCase(12.2, 13.5)]
+ public void CreateInputWithAquiferAndCoverageLayer_DifferentInputs_ExpectedValues(double thicknessAquiferLayer, double thicknessCoverageLayer)
+ {
+ // Call
+ PipingInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer(thicknessAquiferLayer, thicknessCoverageLayer);
+
+ // Assert
+ Assert.AreEqual(0.5, input.ExitPointL);
+ Assert.AreEqual(new[]
+ {
+ new Point2D(0, thicknessCoverageLayer),
+ new Point2D(1.0, thicknessCoverageLayer)
+ }, input.SurfaceLine.LocalGeometry);
+ PipingSoilProfile profile = input.StochasticSoilProfile.SoilProfile;
+ Assert.AreEqual(-thicknessAquiferLayer, profile.Bottom);
+ Assert.AreEqual(2, profile.Layers.Count());
+ AssertLayer(false, thicknessCoverageLayer, profile.Layers.ElementAt(0));
+ AssertLayer(true, 0.0, profile.Layers.ElementAt(1));
+ }
+
+ [Test]
+ public void CreateInputWithAquifer_WithoutInputs_ExpectedValues()
+ {
+ // Call
+ PipingInput input = PipingInputFactory.CreateInputWithAquifer();
+
+ // Assert
+ Assert.AreEqual(0.5, input.ExitPointL);
+ Assert.AreEqual(new[]
+ {
+ new Point2D(0, 0.0),
+ new Point2D(1.0, 0.0)
+ }, input.SurfaceLine.LocalGeometry);
+ PipingSoilProfile profile = input.StochasticSoilProfile.SoilProfile;
+ Assert.AreEqual(-1.0, profile.Bottom);
+ Assert.AreEqual(1, profile.Layers.Count());
+ AssertLayer(true, 0.0, profile.Layers.ElementAt(0));
+ }
+
+ [Test]
+ [TestCase(2.0)]
+ [TestCase(12.2)]
+ public void CreateInputWithAquifer_DifferentInputs_ExpectedValues(double thicknessAquiferLayer)
+ {
+ // Call
+ PipingInput input = PipingInputFactory.CreateInputWithAquifer(thicknessAquiferLayer);
+
+ // Assert
+ Assert.AreEqual(0.5, input.ExitPointL);
+ Assert.AreEqual(new[]
+ {
+ new Point2D(0, 0.0),
+ new Point2D(1.0, 0.0)
+ }, input.SurfaceLine.LocalGeometry);
+ PipingSoilProfile profile = input.StochasticSoilProfile.SoilProfile;
+ Assert.AreEqual(-thicknessAquiferLayer, profile.Bottom);
+ Assert.AreEqual(1, profile.Layers.Count());
+ AssertLayer(true, 0.0, profile.Layers.ElementAt(0));
+ }
+
+ [Test]
+ [TestCase(2.0)]
+ [TestCase(12.2)]
+ public void CreateInputWithSingleAquiferLayerAboveSurfaceLine_DifferentInputs_ExpectedValues(double deltaAboveSurfaceLine)
+ {
+ // Call
+ PipingInput input = PipingInputFactory.CreateInputWithSingleAquiferLayerAboveSurfaceLine(deltaAboveSurfaceLine);
+
+ // Assert
+ Assert.AreEqual(0.5, input.ExitPointL);
+ Assert.AreEqual(new[]
+ {
+ new Point2D(0, 2.0),
+ new Point2D(1.0, 2.0)
+ }, input.SurfaceLine.LocalGeometry);
+ PipingSoilProfile profile = input.StochasticSoilProfile.SoilProfile;
+ Assert.AreEqual(0.0, profile.Bottom);
+ Assert.AreEqual(3, profile.Layers.Count());
+ AssertLayer(false, 4.0 + deltaAboveSurfaceLine, profile.Layers.ElementAt(0));
+ AssertLayer(true, 3.0 + deltaAboveSurfaceLine, profile.Layers.ElementAt(1));
+ AssertLayer(false, 2.0 + deltaAboveSurfaceLine, profile.Layers.ElementAt(2));
+ }
+
+ [Test]
+ public void CreateInputWithMultipleAquiferLayersUnderSurfaceLine_Alwyas_ReturnsExpectedValues()
+ {
+ // Setup
+ double expectedAquiferThickness;
+
+ // Call
+ PipingInput input = PipingInputFactory.CreateInputWithMultipleAquiferLayersUnderSurfaceLine(out expectedAquiferThickness);
+
+ // Assert
+ Assert.AreEqual(0.5, input.ExitPointL);
+ Assert.AreEqual(new[]
+ {
+ new Point2D(0, 3.3),
+ new Point2D(1.0, 3.3)
+ }, input.SurfaceLine.LocalGeometry);
+ PipingSoilProfile profile = input.StochasticSoilProfile.SoilProfile;
+ Assert.AreEqual(0.0, profile.Bottom);
+ Assert.AreEqual(3, profile.Layers.Count());
+ AssertLayer(false, 4.3, profile.Layers.ElementAt(0));
+ AssertLayer(true, 3.3, profile.Layers.ElementAt(1));
+ AssertLayer(true, 1.1, profile.Layers.ElementAt(2));
+ Assert.AreEqual(3.3, expectedAquiferThickness);
+ }
+
+ private static void AssertLayer(bool aquifer, double top, PipingSoilLayer pipingSoilLayer)
+ {
+ Assert.AreEqual(aquifer, pipingSoilLayer.IsAquifer);
+ Assert.AreEqual(top, pipingSoilLayer.Top);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil.Test/Ringtoets.Piping.Data.TestUtil.Test.csproj
===================================================================
diff -u -r5e70f173b3839314912e086b6c1c784b975ee646 -r8b07dff41637bfd485f412ec534f2ddd7fe27c00
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil.Test/Ringtoets.Piping.Data.TestUtil.Test.csproj (.../Ringtoets.Piping.Data.TestUtil.Test.csproj) (revision 5e70f173b3839314912e086b6c1c784b975ee646)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil.Test/Ringtoets.Piping.Data.TestUtil.Test.csproj (.../Ringtoets.Piping.Data.TestUtil.Test.csproj) (revision 8b07dff41637bfd485f412ec534f2ddd7fe27c00)
@@ -50,6 +50,7 @@
Properties\GlobalAssembly.cs
+
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/PipingInputFactory.cs
===================================================================
diff -u -rcce96a7520196dcc65d1c40d03fbbf473340088d -r8b07dff41637bfd485f412ec534f2ddd7fe27c00
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/PipingInputFactory.cs (.../PipingInputFactory.cs) (revision cce96a7520196dcc65d1c40d03fbbf473340088d)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/PipingInputFactory.cs (.../PipingInputFactory.cs) (revision 8b07dff41637bfd485f412ec534f2ddd7fe27c00)
@@ -69,6 +69,38 @@
}
///
+ /// Creates piping input with an aquifer layer.
+ ///
+ /// The thickness of the aquifer layer.
+ /// A new .
+ public static PipingInput CreateInputWithAquifer(double thicknessAquiferLayer = 1.0)
+ {
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(0, 0, 0.0),
+ new Point3D(1.0, 0, 0.0)
+ });
+ var stochasticSoilProfile = new StochasticSoilProfile(0.0, SoilProfileType.SoilProfile1D, 0)
+ {
+ SoilProfile = new PipingSoilProfile(string.Empty, -thicknessAquiferLayer, new[]
+ {
+ new PipingSoilLayer(0.0)
+ {
+ IsAquifer = true
+ }
+ }, SoilProfileType.SoilProfile1D, 0)
+ };
+
+ return new PipingInput(new GeneralPipingInput())
+ {
+ SurfaceLine = surfaceLine,
+ StochasticSoilProfile = stochasticSoilProfile,
+ ExitPointL = (RoundedDouble) 0.5
+ };
+ }
+
+ ///
/// Creates piping input with a single aquifer layer above the surface line.
///
/// The distance between the aquifer layer and the surface line.
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/VariationCoefficientDesignVariablePropertiesTest.cs
===================================================================
diff -u -r2230d58267d9924153aa45d0398ea2623f9ad198 -r8b07dff41637bfd485f412ec534f2ddd7fe27c00
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/VariationCoefficientDesignVariablePropertiesTest.cs (.../VariationCoefficientDesignVariablePropertiesTest.cs) (revision 2230d58267d9924153aa45d0398ea2623f9ad198)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/VariationCoefficientDesignVariablePropertiesTest.cs (.../VariationCoefficientDesignVariablePropertiesTest.cs) (revision 8b07dff41637bfd485f412ec534f2ddd7fe27c00)
@@ -111,7 +111,7 @@
public override string DistributionType { get; }
}
- public class SimpleVariationCoefficientDesignVariableProperties : VariationCoefficientDesignVariable
+ private class SimpleVariationCoefficientDesignVariableProperties : VariationCoefficientDesignVariable
{
private RoundedDouble designValue;
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/VariationCoefficientLogNormalDistributionDesignVariablePropertiesTest.cs
===================================================================
diff -u -r2230d58267d9924153aa45d0398ea2623f9ad198 -r8b07dff41637bfd485f412ec534f2ddd7fe27c00
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/VariationCoefficientLogNormalDistributionDesignVariablePropertiesTest.cs (.../VariationCoefficientLogNormalDistributionDesignVariablePropertiesTest.cs) (revision 2230d58267d9924153aa45d0398ea2623f9ad198)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/VariationCoefficientLogNormalDistributionDesignVariablePropertiesTest.cs (.../VariationCoefficientLogNormalDistributionDesignVariablePropertiesTest.cs) (revision 8b07dff41637bfd485f412ec534f2ddd7fe27c00)
@@ -60,7 +60,7 @@
Assert.AreSame(distribution, properties.Data);
Assert.AreEqual(distribution.Mean, properties.Mean);
Assert.AreEqual(distribution.CoefficientOfVariation, properties.CoefficientOfVariation);
- Assert.AreEqual("Lognormaal", properties.DistributionType);
+ Assert.AreEqual("Lognormaal", properties.DistributionType);
}
[Test]
@@ -73,8 +73,8 @@
// Call
TestDelegate test = () => new VariationCoefficientLogNormalDistributionDesignVariableProperties(VariationCoefficientDistributionPropertiesReadOnly.None,
- null,
- handler);
+ null,
+ handler);
// Assert
var exception = Assert.Throws(test);
@@ -95,8 +95,8 @@
// Call
var properties = new VariationCoefficientLogNormalDistributionDesignVariableProperties(VariationCoefficientDistributionPropertiesReadOnly.All,
- designVariable,
- handler);
+ designVariable,
+ handler);
// Assert
Assert.IsInstanceOf>(properties);
@@ -120,8 +120,8 @@
// Call
var properties = new VariationCoefficientLogNormalDistributionDesignVariableProperties(VariationCoefficientDistributionPropertiesReadOnly.None,
- designVariable,
- handler);
+ designVariable,
+ handler);
// Assert
PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
@@ -172,8 +172,8 @@
// Call
var properties = new VariationCoefficientLogNormalDistributionDesignVariableProperties(VariationCoefficientDistributionPropertiesReadOnly.None,
- designVariable,
- handler);
+ designVariable,
+ handler);
// Assert
Assert.AreEqual("Lognormaal", properties.DistributionType);
Index: Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingSemiProbabilisticDesignValueFactoryTest.cs
===================================================================
diff -u -rf817bfc2122cfa0a48bd19ad8518a948dfd7c95c -r8b07dff41637bfd485f412ec534f2ddd7fe27c00
--- Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingSemiProbabilisticDesignValueFactoryTest.cs (.../PipingSemiProbabilisticDesignValueFactoryTest.cs) (revision f817bfc2122cfa0a48bd19ad8518a948dfd7c95c)
+++ Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingSemiProbabilisticDesignValueFactoryTest.cs (.../PipingSemiProbabilisticDesignValueFactoryTest.cs) (revision 8b07dff41637bfd485f412ec534f2ddd7fe27c00)
@@ -226,14 +226,14 @@
#endregion
- private void AssertPercentile(double percentile, DesignVariable designVariable) where T : IDistribution
+ private static void AssertPercentile(double percentile, DesignVariable designVariable) where T : IDistribution
{
Assert.IsInstanceOf>(designVariable);
var percentileBasedDesignVariable = (PercentileBasedDesignVariable) designVariable;
Assert.AreEqual(percentile, percentileBasedDesignVariable.Percentile);
}
- private void AssertPercentile(double percentile, VariationCoefficientDesignVariable designVariable)
+ private static void AssertPercentile(double percentile, VariationCoefficientDesignVariable designVariable)
{
Assert.IsInstanceOf(designVariable);
var percentileBasedDesignVariable = (VariationCoefficientLogNormalDistributionDesignVariable)designVariable;