Index: Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs
===================================================================
diff -u -r72a2809486183c2a0ecfd8a529b4518f852d250d -ra98b1f041d0befb17b61cbab82450309521c2fc7
--- Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 72a2809486183c2a0ecfd8a529b4518f852d250d)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision a98b1f041d0befb17b61cbab82450309521c2fc7)
@@ -1631,6 +1631,24 @@
}
///
+ /// Looks up a localized string similar to Geen lagen gevonden voor de ondergrondschematisatie..
+ ///
+ public static string SoilProfile_Cannot_construct_SoilProfile_without_layers {
+ get {
+ return ResourceManager.GetString("SoilProfile_Cannot_construct_SoilProfile_without_layers", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Eén of meerdere lagen hebben een top onder de bodem van de ondergrondschematisatie..
+ ///
+ public static string SoilProfile_Layers_Layer_top_below_profile_bottom {
+ get {
+ return ResourceManager.GetString("SoilProfile_Layers_Layer_top_below_profile_bottom", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Kritieke fout opgetreden bij het uitlezen van waardes uit kolommen in de database..
///
public static string SoilProfileReader_Critical_Unexpected_value_on_column {
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx
===================================================================
diff -u -r72a2809486183c2a0ecfd8a529b4518f852d250d -ra98b1f041d0befb17b61cbab82450309521c2fc7
--- Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx (.../Resources.resx) (revision 72a2809486183c2a0ecfd8a529b4518f852d250d)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx (.../Resources.resx) (revision a98b1f041d0befb17b61cbab82450309521c2fc7)
@@ -833,4 +833,10 @@
Ondergrondschematisatie bevat geen geldige waarde in kolom '{0}'.
+
+ Geen lagen gevonden voor de ondergrondschematisatie.
+
+
+ Eén of meerdere lagen hebben een top onder de bodem van de ondergrondschematisatie.
+
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj
===================================================================
diff -u -r72a2809486183c2a0ecfd8a529b4518f852d250d -ra98b1f041d0befb17b61cbab82450309521c2fc7
--- Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision 72a2809486183c2a0ecfd8a529b4518f852d250d)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision a98b1f041d0befb17b61cbab82450309521c2fc7)
@@ -46,6 +46,7 @@
..\..\..\..\packages\System.Data.SQLite.Core.1.0.104.0\lib\net40\System.Data.SQLite.dll
True
+
@@ -128,6 +129,7 @@
+
Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilLayer1D.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilLayer1D.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilLayer1D.cs (revision a98b1f041d0befb17b61cbab82450309521c2fc7)
@@ -0,0 +1,130 @@
+// 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;
+using System.Drawing;
+
+namespace Ringtoets.Common.IO.SoilProfile
+{
+ ///
+ /// This class represents profiles that were imported from D-Soil Model and will later on
+ /// be used to create the necessary input for executing a calculation.
+ ///
+ public class SoilLayer1D
+ {
+ private string materialName;
+
+ ///
+ /// Creates a new instance of , where the top is set to .
+ ///
+ /// The top level of the layer.
+ public SoilLayer1D(double top)
+ {
+ Top = top;
+ MaterialName = string.Empty;
+ BelowPhreaticLevelMean = double.NaN;
+ BelowPhreaticLevelDeviation = double.NaN;
+ BelowPhreaticLevelShift = double.NaN;
+ DiameterD70Mean = double.NaN;
+ DiameterD70CoefficientOfVariation = double.NaN;
+ PermeabilityMean = double.NaN;
+ PermeabilityCoefficientOfVariation = double.NaN;
+ }
+
+ ///
+ /// Gets the top level of the .
+ ///
+ public double Top { get; }
+
+ ///
+ /// Gets or sets a value indicating whether or not the is an aquifer.
+ ///
+ public bool IsAquifer { get; set; }
+
+ ///
+ /// Gets or sets the mean of the distribution for the volumic weight of the
+ /// below the phreatic level.
+ ///
+ public double BelowPhreaticLevelMean { get; set; }
+
+ ///
+ /// Gets or sets the deviation of the distribution for the volumic weight of the
+ /// below the phreatic level.
+ ///
+ public double BelowPhreaticLevelDeviation { get; set; }
+
+ ///
+ /// Gets or sets the shift of the distribution for the volumic weight of the
+ /// below the phreatic level.
+ ///
+ public double BelowPhreaticLevelShift { get; set; }
+
+ ///
+ /// Gets or sets the mean of the distribution for the mean diameter of small scale tests
+ /// applied to different kinds of sand, on which the formula of Sellmeijer has been fit.
+ ///
+ public double DiameterD70Mean { get; set; }
+
+ ///
+ /// Gets or sets the coefficient of variation of the distribution for the mean diameter
+ /// of small scale tests applied to different kinds of sand, on which the formula of Sellmeijer
+ /// has been fit.
+ ///
+ public double DiameterD70CoefficientOfVariation { get; set; }
+
+ ///
+ /// Gets or sets the mean of the distribution for the the Darcy-speed with which water
+ /// flows through the aquifer layer.
+ ///
+ public double PermeabilityMean { get; set; }
+
+ ///
+ /// Gets or sets the coefficient of variation of the distribution for the Darcy-speed
+ /// with which water flows through the aquifer layer.
+ ///
+ public double PermeabilityCoefficientOfVariation { get; set; }
+
+ ///
+ /// Gets or sets the name of the material that was assigned to the .
+ ///
+ /// Thrown when is null.
+ public string MaterialName
+ {
+ get
+ {
+ return materialName;
+ }
+ set
+ {
+ if (value == null)
+ {
+ throw new ArgumentNullException(nameof(value));
+ }
+ materialName = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the that was used to represent the .
+ ///
+ public Color Color { get; set; }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilProfile1D.cs
===================================================================
diff -u -r58d98ab4a0a75497b2752eff1a931f6f7ee3fa8a -ra98b1f041d0befb17b61cbab82450309521c2fc7
--- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilProfile1D.cs (.../SoilProfile1D.cs) (revision 58d98ab4a0a75497b2752eff1a931f6f7ee3fa8a)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilProfile1D.cs (.../SoilProfile1D.cs) (revision a98b1f041d0befb17b61cbab82450309521c2fc7)
@@ -19,29 +19,93 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Ringtoets.Common.IO.Properties;
+
namespace Ringtoets.Common.IO.SoilProfile
{
///
/// This class represents a one dimensional soil profile.
///
public class SoilProfile1D : ISoilProfile
{
+ private SoilLayer1D[] soilLayers;
+
///
/// Creates a new instance of .
///
/// The name of the profile.
/// The bottom level of the profile.
- public SoilProfile1D(string name, double bottom)
+ /// The collection of layers that should be part of the profile.
+ /// Thrown when is null.
+ /// Thrown when:
+ ///
+ /// - contains no layers
+ /// - contains a layer with the less than
+ ///
+ ///
+ ///
+ public SoilProfile1D(string name, double bottom, IEnumerable layers)
{
Name = name;
Bottom = bottom;
+ Layers = layers;
}
///
/// Gets the bottom level of the .
///
public double Bottom { get; }
+ ///
+ /// Gets an ordered (by , descending) of
+ /// for the .
+ ///
+ /// Thrown when the value is null.
+ /// Thrown when the value contains no layers.
+ public IEnumerable Layers
+ {
+ get
+ {
+ return soilLayers;
+ }
+ private set
+ {
+ ValidateLayersCollection(value);
+ soilLayers = value.OrderByDescending(l => l.Top).ToArray();
+ }
+ }
+
public string Name { get; }
+
+ ///
+ /// Validates the given . A valid has layers which
+ /// all have values for which are greater than or equal to .
+ ///
+ /// The collection of to validate.
+ /// Thrown when is null.
+ /// Thrown when
+ ///
+ /// - contains no layers
+ /// - contains a layer with the less than
+ ///
+ ///
+ private void ValidateLayersCollection(IEnumerable layers)
+ {
+ if (layers == null)
+ {
+ throw new ArgumentNullException(nameof(layers), string.Format(Resources.SoilProfile_Cannot_construct_SoilProfile_without_layers));
+ }
+ if (!layers.Any())
+ {
+ throw new ArgumentException(Resources.SoilProfile_Cannot_construct_SoilProfile_without_layers);
+ }
+ if (layers.Any(l => l.Top < Bottom))
+ {
+ throw new ArgumentException(Resources.SoilProfile_Layers_Layer_top_below_profile_bottom);
+ }
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilProfile1DReader.cs
===================================================================
diff -u -r72a2809486183c2a0ecfd8a529b4518f852d250d -ra98b1f041d0befb17b61cbab82450309521c2fc7
--- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilProfile1DReader.cs (.../SoilProfile1DReader.cs) (revision 72a2809486183c2a0ecfd8a529b4518f852d250d)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilProfile1DReader.cs (.../SoilProfile1DReader.cs) (revision a98b1f041d0befb17b61cbab82450309521c2fc7)
@@ -124,7 +124,7 @@
private SoilProfile1D TryReadSoilProfile()
{
var criticalProperties = new RequiredProfileProperties(this);
- var soilProfile = new SoilProfile1D(criticalProperties.ProfileName, criticalProperties.Bottom);
+ var soilProfile = new SoilProfile1D(criticalProperties.ProfileName, criticalProperties.Bottom, new []{new SoilLayer1D(1000) });
for (var i = 1; i <= criticalProperties.LayerCount; i++)
{
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj
===================================================================
diff -u -r72a2809486183c2a0ecfd8a529b4518f852d250d -ra98b1f041d0befb17b61cbab82450309521c2fc7
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision 72a2809486183c2a0ecfd8a529b4518f852d250d)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision a98b1f041d0befb17b61cbab82450309521c2fc7)
@@ -52,6 +52,7 @@
..\..\..\..\packages\System.Data.SQLite.Core.1.0.104.0\lib\net40\System.Data.SQLite.dll
True
+
@@ -112,6 +113,7 @@
+
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilLayer1DTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilLayer1DTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilLayer1DTest.cs (revision a98b1f041d0befb17b61cbab82450309521c2fc7)
@@ -0,0 +1,89 @@
+// 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;
+using System.Drawing;
+using NUnit.Framework;
+using Ringtoets.Common.IO.SoilProfile;
+
+namespace Ringtoets.Common.IO.Test.SoilProfile
+{
+ [TestFixture]
+ public class SoilLayer1DTest
+ {
+ [Test]
+ public void Constructor_WithTop_ReturnsNewInstanceWithTopSet()
+ {
+ // Setup
+ double top = new Random(22).NextDouble();
+
+ // Call
+ var layer = new SoilLayer1D(top);
+
+ // Assert
+ Assert.NotNull(layer);
+ Assert.AreEqual(top, layer.Top);
+ Assert.IsFalse(layer.IsAquifer);
+ Assert.IsEmpty(layer.MaterialName);
+ Assert.AreEqual(Color.Empty, layer.Color);
+
+ Assert.IsNaN(layer.BelowPhreaticLevelMean);
+ Assert.IsNaN(layer.BelowPhreaticLevelDeviation);
+ Assert.IsNaN(layer.BelowPhreaticLevelShift);
+
+ Assert.IsNaN(layer.DiameterD70Mean);
+ Assert.IsNaN(layer.DiameterD70CoefficientOfVariation);
+
+ Assert.IsNaN(layer.PermeabilityMean);
+ Assert.IsNaN(layer.PermeabilityCoefficientOfVariation);
+ }
+
+ [Test]
+ public void MaterialName_Null_ThrowsArgumentNullException()
+ {
+ // Setup
+ double top = new Random(22).NextDouble();
+ var layer = new SoilLayer1D(top);
+
+ // Call
+ TestDelegate test = () => layer.MaterialName = null;
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("value", paramName);
+ }
+
+ [Test]
+ public void MaterialName_NotNullValue_ValueSet()
+ {
+ // Setup
+ double top = new Random(22).NextDouble();
+ var layer = new SoilLayer1D(top);
+ string materialName = "a name";
+
+ // Call
+ layer.MaterialName = materialName;
+
+ // Assert
+ Assert.AreEqual(materialName, layer.MaterialName);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilProfile1DTest.cs
===================================================================
diff -u -r58d98ab4a0a75497b2752eff1a931f6f7ee3fa8a -ra98b1f041d0befb17b61cbab82450309521c2fc7
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilProfile1DTest.cs (.../SoilProfile1DTest.cs) (revision 58d98ab4a0a75497b2752eff1a931f6f7ee3fa8a)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilProfile1DTest.cs (.../SoilProfile1DTest.cs) (revision a98b1f041d0befb17b61cbab82450309521c2fc7)
@@ -33,16 +33,20 @@
{
// Setup
const string name = "some name";
- var random = new Random(9);
- int bottom = random.Next();
+ const int bottom = 1;
+ var soilLayer1Ds = new[]
+ {
+ new SoilLayer1D(2)
+ };
// Call
- var soilProfile1D = new SoilProfile1D(name, bottom);
+ var soilProfile1D = new SoilProfile1D(name, bottom, soilLayer1Ds);
// Assert
Assert.IsInstanceOf(soilProfile1D);
Assert.AreEqual(name, soilProfile1D.Name);
Assert.AreEqual(bottom, soilProfile1D.Bottom);
+ CollectionAssert.AreEqual(soilLayer1Ds, soilProfile1D.Layers);
}
}
}
\ No newline at end of file