Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/Input/UpliftVanShearStrengthModel.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/Input/UpliftVanShearStrengthModel.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/Input/UpliftVanShearStrengthModel.cs (revision ce7fdfb3ce781bfa892f2197d7fe693f3b033c3a) @@ -0,0 +1,33 @@ +// 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. + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan.Input +{ + /// + /// All shear strength model types. + /// + public enum UpliftVanShearStrengthModel + { + SuCalculated = 1, + CPhi = 2, + CPhiOrSuCalculated = 3 + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/Input/UpliftVanSoilLayer.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/Input/UpliftVanSoilLayer.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/Input/UpliftVanSoilLayer.cs (revision ce7fdfb3ce781bfa892f2197d7fe693f3b033c3a) @@ -0,0 +1,210 @@ +// 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.Collections.Generic; +using Core.Common.Base.Geometry; + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan.Input +{ + /// + /// A 2D soil layer that has been adapted to perform a calculation. + /// + public class UpliftVanSoilLayer + { + /// + /// Creates a new instance of . + /// + /// The object containing the values for + /// the properties of the new . + /// Thrown when + /// is null. + public UpliftVanSoilLayer(Point2D[] outerRing, IEnumerable holes, ConstructionProperties properties) + { + if (outerRing == null) + { + throw new ArgumentNullException(nameof(outerRing)); + } + if (holes == null) + { + throw new ArgumentNullException(nameof(holes)); + } + if (properties == null) + { + throw new ArgumentNullException(nameof(properties)); + } + + OuterRing = outerRing; + Holes = holes; + + IsAquifer = properties.IsAquifer; + UsePop = properties.UsePop; + ShearStrengthModel = properties.ShearStrengthModel; + MaterialName = properties.MaterialName; + AbovePhreaticLevel = properties.AbovePhreaticLevel; + BelowPhreaticLevel = properties.BelowPhreaticLevel; + Cohesion = properties.Cohesion; + FrictionAngle = properties.FrictionAngle; + StrengthIncreaseExponent = properties.StrengthIncreaseExponent; + ShearStrengthRatio = properties.ShearStrengthRatio; + Pop = properties.Pop; + } + + /// + /// Gets the outer ring of the geometry. + /// + public Point2D[] OuterRing { get; } + + /// + /// Gets the holes of the geometry. + /// + public IEnumerable Holes { get; } + + /// + /// Gets a value indicating whether the layer is an aquifer. + /// + public bool IsAquifer { get; } + + /// + /// Gets a value indicating whether to use POP for the layer. + /// + public bool UsePop { get; } + + /// + /// Gets the shear strength model to use for the layer. + /// + public UpliftVanShearStrengthModel ShearStrengthModel { get; } + + /// + /// Gets the name of the material that was assigned to the layer. + /// + public string MaterialName { get; } + + /// + /// Gets the volumic weight of the layer above the phreatic level. + /// + public double AbovePhreaticLevel { get; } + + /// + /// Gets the volumic weight of the layer below the phreatic level. + /// + public double BelowPhreaticLevel { get; } + + /// + /// Gets the cohesion. + /// + public double Cohesion { get; } + + /// + /// Gets the friction angle. + /// + public double FrictionAngle { get; } + + /// + /// Gets the strength increase exponent. + /// + public double StrengthIncreaseExponent { get; } + + /// + /// Gets the shear strength ratio. + /// + public double ShearStrengthRatio { get; } + + /// + /// Gets the Pop. + /// + public double Pop { get; } + + public class ConstructionProperties + { + /// + /// Creates a new instance of . + /// + public ConstructionProperties() + { + ShearStrengthModel = UpliftVanShearStrengthModel.CPhi; + MaterialName = string.Empty; + AbovePhreaticLevel = double.NaN; + BelowPhreaticLevel = double.NaN; + Cohesion = double.NaN; + FrictionAngle = double.NaN; + StrengthIncreaseExponent = double.NaN; + ShearStrengthRatio = double.NaN; + Pop = double.NaN; + } + + /// + /// Gets or sets a value indicating whether the layer is an aquifer. + /// + public bool IsAquifer { internal get; set; } + + /// + /// Gets or sets a value indicating whether to use POP for the layer. + /// + public bool UsePop { internal get; set; } + + /// + /// Gets or sets the shear strength model to use for the layer. + /// + public UpliftVanShearStrengthModel ShearStrengthModel { internal get; set; } + + /// + /// Gets or sets the name of the material that was assigned to the layer. + /// + public string MaterialName { internal get; set; } + + /// + /// Gets or sets the volumic weight of the layer above the phreatic level. + /// + public double AbovePhreaticLevel { internal get; set; } + + /// + /// Gets or sets the volumic weight of the layer below the phreatic level. + /// + public double BelowPhreaticLevel { internal get; set; } + + /// + /// Gets or sets the cohesion. + /// + public double Cohesion { internal get; set; } + + /// + /// Gets or sets the friction angle. + /// + public double FrictionAngle { internal get; set; } + + /// + /// Gets or sets the strength increase exponent. + /// + public double StrengthIncreaseExponent { internal get; set; } + + /// + /// Gets or sets the shear strength ratio. + /// + public double ShearStrengthRatio { internal get; set; } + + /// + /// Gets or sets the Pop. + /// + public double Pop { internal get; set; } + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/Input/UpliftVanSoilProfile.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/Input/UpliftVanSoilProfile.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/Input/UpliftVanSoilProfile.cs (revision ce7fdfb3ce781bfa892f2197d7fe693f3b033c3a) @@ -0,0 +1,53 @@ +// 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.Collections.Generic; + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan.Input +{ + /// + /// A soil profile for which its properties have been adapted to perform a calculation. + /// + public class UpliftVanSoilProfile + { + /// + /// Creates a new instance of + /// + /// The layers in the profile. + /// Thrown when any parameter + /// is null. + public UpliftVanSoilProfile(IEnumerable layers) + { + if (layers == null) + { + throw new ArgumentNullException(nameof(layers)); + } + + Layers = layers; + } + + /// + /// Gets the layers in the profile. + /// + public IEnumerable Layers { get; } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj =================================================================== diff -u -rf2821a4b299043f78c93fb0acf5851081f96961b -rce7fdfb3ce781bfa892f2197d7fe693f3b033c3a --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.csproj) (revision f2821a4b299043f78c93fb0acf5851081f96961b) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.csproj) (revision ce7fdfb3ce781bfa892f2197d7fe693f3b033c3a) @@ -43,6 +43,9 @@ Properties\GlobalAssembly.cs + + + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Calculators/UpliftVan/Input/UpliftVanSoilLayerTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Calculators/UpliftVan/Input/UpliftVanSoilLayerTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Calculators/UpliftVan/Input/UpliftVanSoilLayerTest.cs (revision ce7fdfb3ce781bfa892f2197d7fe693f3b033c3a) @@ -0,0 +1,159 @@ +// 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 Core.Common.Base.Geometry; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan.Input; + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Test.Calculators.UpliftVan.Input +{ + [TestFixture] + public class UpliftVanSoilLayerTest + { + [Test] + public void Constructor_ConstructionPropertiesNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new UpliftVanSoilLayer(new Point2D[0], new Point2D[0][], null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("properties", exception.ParamName); + } + + [Test] + public void Constructor_OuterRingNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new UpliftVanSoilLayer(null, new Point2D[0][], new UpliftVanSoilLayer.ConstructionProperties()); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("outerRing", exception.ParamName); + } + + [Test] + public void Constructor_HolesNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new UpliftVanSoilLayer(new Point2D[0], null, new UpliftVanSoilLayer.ConstructionProperties()); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("holes", exception.ParamName); + } + + [Test] + public void Constructor_WithAllParameters_ExpectedValues() + { + // Setup + var outerRing = new[] + { + new Point2D(0, 0), + new Point2D(1, 1) + }; + var holes = new[] + { + new[] + { + new Point2D(0, 0), + new Point2D(1, 1) + } + }; + + // Call + var layer = new UpliftVanSoilLayer(outerRing, holes, new UpliftVanSoilLayer.ConstructionProperties()); + + // Assert + CollectionAssert.AreEqual(outerRing, layer.OuterRing); + CollectionAssert.AreEqual(holes, layer.Holes); + } + + [Test] + public void Constructor_EmptyConstructionProperties_ExpectedValues() + { + // Call + var layer = new UpliftVanSoilLayer(new Point2D[0], new Point2D[0][], new UpliftVanSoilLayer.ConstructionProperties()); + + // Assert + Assert.IsFalse(layer.IsAquifer); + Assert.IsFalse(layer.UsePop); + Assert.IsEmpty(layer.MaterialName); + Assert.AreEqual(UpliftVanShearStrengthModel.CPhi, layer.ShearStrengthModel); + Assert.IsNaN(layer.AbovePhreaticLevel); + Assert.IsNaN(layer.BelowPhreaticLevel); + Assert.IsNaN(layer.Cohesion); + Assert.IsNaN(layer.FrictionAngle); + Assert.IsNaN(layer.ShearStrengthRatio); + Assert.IsNaN(layer.StrengthIncreaseExponent); + Assert.IsNaN(layer.Pop); + } + + [Test] + public void Constructor_WithConstructionProperties_ExpectedValues() + { + // Setup + const string materialName = "test"; + var random = new Random(11); + bool isAquifer = random.NextBoolean(); + bool usePop = random.NextBoolean(); + var shearStrengthModel = random.NextEnumValue(); + double abovePhreaticLevel = random.NextDouble(); + double belowPhreaticLevel = random.NextDouble(); + double cohesion = random.NextDouble(); + double frictionAngle = random.NextDouble(); + double shearStrengthRatio = random.NextDouble(); + double strengthIncreaseExponent = random.NextDouble(); + double pop = random.NextDouble(); + + // Call + var layer = new UpliftVanSoilLayer(new Point2D[0], new Point2D[0][], new UpliftVanSoilLayer.ConstructionProperties + { + MaterialName = materialName, + IsAquifer = isAquifer, + UsePop = usePop, + ShearStrengthModel = shearStrengthModel, + AbovePhreaticLevel = abovePhreaticLevel, + BelowPhreaticLevel = belowPhreaticLevel, + Cohesion = cohesion, + FrictionAngle = frictionAngle, + ShearStrengthRatio = shearStrengthRatio, + StrengthIncreaseExponent = strengthIncreaseExponent, + Pop = pop + }); + + // Assert + Assert.AreEqual(materialName, layer.MaterialName); + Assert.AreEqual(isAquifer, layer.IsAquifer); + Assert.AreEqual(usePop, layer.UsePop); + Assert.AreEqual(shearStrengthModel, layer.ShearStrengthModel); + Assert.AreEqual(abovePhreaticLevel, layer.AbovePhreaticLevel); + Assert.AreEqual(belowPhreaticLevel, layer.BelowPhreaticLevel); + Assert.AreEqual(cohesion, layer.Cohesion); + Assert.AreEqual(frictionAngle, layer.FrictionAngle); + Assert.AreEqual(shearStrengthRatio, layer.ShearStrengthRatio); + Assert.AreEqual(strengthIncreaseExponent, layer.StrengthIncreaseExponent); + Assert.AreEqual(pop, layer.Pop); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Calculators/UpliftVan/Input/UpliftVanSoilProfileTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Calculators/UpliftVan/Input/UpliftVanSoilProfileTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Calculators/UpliftVan/Input/UpliftVanSoilProfileTest.cs (revision ce7fdfb3ce781bfa892f2197d7fe693f3b033c3a) @@ -0,0 +1,42 @@ +// 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 NUnit.Framework; +using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan.Input; + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Test.Calculators.UpliftVan.Input +{ + [TestFixture] + public class UpliftVanSoilProfileTest + { + [Test] + public void Constructor_LayersNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new UpliftVanSoilProfile(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("layers", exception.ParamName); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj =================================================================== diff -u -rf2821a4b299043f78c93fb0acf5851081f96961b -rce7fdfb3ce781bfa892f2197d7fe693f3b033c3a --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj) (revision f2821a4b299043f78c93fb0acf5851081f96961b) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj) (revision ce7fdfb3ce781bfa892f2197d7fe693f3b033c3a) @@ -60,6 +60,8 @@ Properties\GlobalAssembly.cs + +