Index: Ringtoets.sln =================================================================== diff -u -r14c118039f313ea66787d8065daad0aa783b731a -rcfa7dc2bce5e37f5677d9c8772b68599f9e26a0c --- Ringtoets.sln (.../Ringtoets.sln) (revision 14c118039f313ea66787d8065daad0aa783b731a) +++ Ringtoets.sln (.../Ringtoets.sln) (revision cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c) @@ -1741,11 +1741,6 @@ {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ringtoets.MacroStabilityInwards.Service.TestUtil", "Ringtoets\MacroStabilityInwards\test\Ringtoets.MacroStabilityInwards.Service.TestUtil\Ringtoets.MacroStabilityInwards.Service.TestUtil.csproj", "{F966AE28-DE6B-497A-8449-37EC607E9F69}" - ProjectSection(ProjectDependencies) = postProject - {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} - EndProjectSection -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ringtoets.Piping.IO.TestUtil", "Ringtoets\Piping\test\Ringtoets.Piping.IO.TestUtil\Ringtoets.Piping.IO.TestUtil.csproj", "{58E2D4FD-9DFA-4A05-99C6-5A2E8ADCF90A}" ProjectSection(ProjectDependencies) = postProject {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} @@ -1786,6 +1781,11 @@ {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil", "Ringtoets\MacroStabilityInwards\test\Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil\Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil.csproj", "{53F7C73E-6D85-4B90-A6A8-DAA7F4BCB071}" + ProjectSection(ProjectDependencies) = postProject + {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution CreateInstaller|x86 = CreateInstaller|x86 @@ -4434,14 +4434,6 @@ {D1234D03-76BC-437D-B941-DFF14A2A108D}.Release|x86.Build.0 = Release|x86 {D1234D03-76BC-437D-B941-DFF14A2A108D}.ReleaseForCodeCoverage|x86.ActiveCfg = ReleaseForCodeCoverage|x86 {D1234D03-76BC-437D-B941-DFF14A2A108D}.ReleaseForCodeCoverage|x86.Build.0 = ReleaseForCodeCoverage|x86 - {F966AE28-DE6B-497A-8449-37EC607E9F69}.CreateInstaller|x86.ActiveCfg = Release|x86 - {F966AE28-DE6B-497A-8449-37EC607E9F69}.CreateInstallerWithDemoProject|x86.ActiveCfg = Release|x86 - {F966AE28-DE6B-497A-8449-37EC607E9F69}.Debug|x86.ActiveCfg = Debug|x86 - {F966AE28-DE6B-497A-8449-37EC607E9F69}.Debug|x86.Build.0 = Debug|x86 - {F966AE28-DE6B-497A-8449-37EC607E9F69}.Release|x86.ActiveCfg = Release|x86 - {F966AE28-DE6B-497A-8449-37EC607E9F69}.Release|x86.Build.0 = Release|x86 - {F966AE28-DE6B-497A-8449-37EC607E9F69}.ReleaseForCodeCoverage|x86.ActiveCfg = ReleaseForCodeCoverage|x86 - {F966AE28-DE6B-497A-8449-37EC607E9F69}.ReleaseForCodeCoverage|x86.Build.0 = ReleaseForCodeCoverage|x86 {58E2D4FD-9DFA-4A05-99C6-5A2E8ADCF90A}.CreateInstaller|x86.ActiveCfg = Release|x86 {58E2D4FD-9DFA-4A05-99C6-5A2E8ADCF90A}.CreateInstallerWithDemoProject|x86.ActiveCfg = Release|x86 {58E2D4FD-9DFA-4A05-99C6-5A2E8ADCF90A}.Debug|x86.ActiveCfg = Debug|x86 @@ -4492,26 +4484,30 @@ {9FB4BF13-EB15-4676-A3D4-C30DFC33631E}.Release|x86.Build.0 = Release|x86 {9FB4BF13-EB15-4676-A3D4-C30DFC33631E}.ReleaseForCodeCoverage|x86.ActiveCfg = ReleaseForCodeCoverage|x86 {9FB4BF13-EB15-4676-A3D4-C30DFC33631E}.ReleaseForCodeCoverage|x86.Build.0 = ReleaseForCodeCoverage|x86 - {1DF4EE8D-0EF5-4FCC-A40E-CB8B82080FDF}.CreateInstaller|x86.ActiveCfg = ReleaseForCodeCoverage|x86 - {1DF4EE8D-0EF5-4FCC-A40E-CB8B82080FDF}.CreateInstaller|x86.Build.0 = ReleaseForCodeCoverage|x86 - {1DF4EE8D-0EF5-4FCC-A40E-CB8B82080FDF}.CreateInstallerWithDemoProject|x86.ActiveCfg = ReleaseForCodeCoverage|x86 - {1DF4EE8D-0EF5-4FCC-A40E-CB8B82080FDF}.CreateInstallerWithDemoProject|x86.Build.0 = ReleaseForCodeCoverage|x86 + {1DF4EE8D-0EF5-4FCC-A40E-CB8B82080FDF}.CreateInstaller|x86.ActiveCfg = Release|x86 + {1DF4EE8D-0EF5-4FCC-A40E-CB8B82080FDF}.CreateInstallerWithDemoProject|x86.ActiveCfg = Release|x86 {1DF4EE8D-0EF5-4FCC-A40E-CB8B82080FDF}.Debug|x86.ActiveCfg = Debug|x86 {1DF4EE8D-0EF5-4FCC-A40E-CB8B82080FDF}.Debug|x86.Build.0 = Debug|x86 {1DF4EE8D-0EF5-4FCC-A40E-CB8B82080FDF}.Release|x86.ActiveCfg = Release|x86 {1DF4EE8D-0EF5-4FCC-A40E-CB8B82080FDF}.Release|x86.Build.0 = Release|x86 {1DF4EE8D-0EF5-4FCC-A40E-CB8B82080FDF}.ReleaseForCodeCoverage|x86.ActiveCfg = ReleaseForCodeCoverage|x86 {1DF4EE8D-0EF5-4FCC-A40E-CB8B82080FDF}.ReleaseForCodeCoverage|x86.Build.0 = ReleaseForCodeCoverage|x86 - {C80AD710-0F84-40CE-9567-10CBE332E589}.CreateInstaller|x86.ActiveCfg = ReleaseForCodeCoverage|x86 - {C80AD710-0F84-40CE-9567-10CBE332E589}.CreateInstaller|x86.Build.0 = ReleaseForCodeCoverage|x86 - {C80AD710-0F84-40CE-9567-10CBE332E589}.CreateInstallerWithDemoProject|x86.ActiveCfg = ReleaseForCodeCoverage|x86 - {C80AD710-0F84-40CE-9567-10CBE332E589}.CreateInstallerWithDemoProject|x86.Build.0 = ReleaseForCodeCoverage|x86 + {C80AD710-0F84-40CE-9567-10CBE332E589}.CreateInstaller|x86.ActiveCfg = Release|x86 + {C80AD710-0F84-40CE-9567-10CBE332E589}.CreateInstallerWithDemoProject|x86.ActiveCfg = Release|x86 {C80AD710-0F84-40CE-9567-10CBE332E589}.Debug|x86.ActiveCfg = Debug|x86 {C80AD710-0F84-40CE-9567-10CBE332E589}.Debug|x86.Build.0 = Debug|x86 {C80AD710-0F84-40CE-9567-10CBE332E589}.Release|x86.ActiveCfg = Release|x86 {C80AD710-0F84-40CE-9567-10CBE332E589}.Release|x86.Build.0 = Release|x86 {C80AD710-0F84-40CE-9567-10CBE332E589}.ReleaseForCodeCoverage|x86.ActiveCfg = ReleaseForCodeCoverage|x86 {C80AD710-0F84-40CE-9567-10CBE332E589}.ReleaseForCodeCoverage|x86.Build.0 = ReleaseForCodeCoverage|x86 + {53F7C73E-6D85-4B90-A6A8-DAA7F4BCB071}.CreateInstaller|x86.ActiveCfg = Release|x86 + {53F7C73E-6D85-4B90-A6A8-DAA7F4BCB071}.CreateInstallerWithDemoProject|x86.ActiveCfg = Release|x86 + {53F7C73E-6D85-4B90-A6A8-DAA7F4BCB071}.Debug|x86.ActiveCfg = Debug|x86 + {53F7C73E-6D85-4B90-A6A8-DAA7F4BCB071}.Debug|x86.Build.0 = Debug|x86 + {53F7C73E-6D85-4B90-A6A8-DAA7F4BCB071}.Release|x86.ActiveCfg = Release|x86 + {53F7C73E-6D85-4B90-A6A8-DAA7F4BCB071}.Release|x86.Build.0 = Release|x86 + {53F7C73E-6D85-4B90-A6A8-DAA7F4BCB071}.ReleaseForCodeCoverage|x86.ActiveCfg = ReleaseForCodeCoverage|x86 + {53F7C73E-6D85-4B90-A6A8-DAA7F4BCB071}.ReleaseForCodeCoverage|x86.Build.0 = ReleaseForCodeCoverage|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -4885,7 +4881,6 @@ {B727E93A-74B2-467A-AE46-9A4E39ED4B5F} = {41023317-95BB-4147-8154-87B45837E752} {0FBC0EA1-89AA-4E34-A8A7-C04A3B866CE7} = {69B95FED-E2DF-42E8-BF6E-8A94EFACD2DC} {D1234D03-76BC-437D-B941-DFF14A2A108D} = {2B6156FD-080B-4869-B148-E4A2995F0EFB} - {F966AE28-DE6B-497A-8449-37EC607E9F69} = {A39CC244-FBB2-4221-82B9-92CC837EF1DC} {58E2D4FD-9DFA-4A05-99C6-5A2E8ADCF90A} = {1F0D20C2-7F04-431D-AF22-95A31FD53733} {28665A2A-9B74-4297-977B-00A8619AF2EE} = {1F0D20C2-7F04-431D-AF22-95A31FD53733} {C83B2091-339A-4F35-A874-A4C807F55CAE} = {A39CC244-FBB2-4221-82B9-92CC837EF1DC} @@ -4894,6 +4889,7 @@ {9FB4BF13-EB15-4676-A3D4-C30DFC33631E} = {A39CC244-FBB2-4221-82B9-92CC837EF1DC} {1DF4EE8D-0EF5-4FCC-A40E-CB8B82080FDF} = {A39CC244-FBB2-4221-82B9-92CC837EF1DC} {C80AD710-0F84-40CE-9567-10CBE332E589} = {A39CC244-FBB2-4221-82B9-92CC837EF1DC} + {53F7C73E-6D85-4B90-A6A8-DAA7F4BCB071} = {A39CC244-FBB2-4221-82B9-92CC837EF1DC} EndGlobalSection GlobalSection(TextTemplating) = postSolution TextTemplating = 1 Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Converters/DrainageConstructionConverter.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Converters/DrainageConstructionConverter.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Converters/DrainageConstructionConverter.cs (revision cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c) @@ -0,0 +1,57 @@ +// 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 Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.Input; +using Ringtoets.MacroStabilityInwards.Primitives; + +namespace Ringtoets.MacroStabilityInwards.CalculatedInput.Converters +{ + /// + /// Converter to convert drainage properties + /// into . + /// + public static class DrainageConstructionConverter + { + /// + /// Converts drainage properties + /// into . + /// + /// The input to get the properties from. + /// The converted . + /// Thrown when + /// is null. + public static DrainageConstruction Convert(IMacroStabilityInwardsWaternetInput input) + { + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + bool isClayDike = input.DikeSoilScenario == MacroStabilityInwardsDikeSoilScenario.ClayDikeOnClay + || input.DikeSoilScenario == MacroStabilityInwardsDikeSoilScenario.ClayDikeOnSand; + + return !isClayDike && input.DrainageConstructionPresent + ? new DrainageConstruction(input.XCoordinateDrainageConstruction, input.ZCoordinateDrainageConstruction) + : new DrainageConstruction(); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Converters/PhreaticLineOffsetsConverter.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Converters/PhreaticLineOffsetsConverter.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Converters/PhreaticLineOffsetsConverter.cs (revision cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c) @@ -0,0 +1,57 @@ +// 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 Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.Input; +using Ringtoets.MacroStabilityInwards.Primitives; + +namespace Ringtoets.MacroStabilityInwards.CalculatedInput.Converters +{ + /// + /// Converter to convert phreatic line offset properties + /// into . + /// + public static class PhreaticLineOffsetsConverter + { + /// + /// Converts phreatic line offset properties + /// into . + /// + /// The input to get the properties from. + /// The converted . + /// Thrown when + /// is null. + public static PhreaticLineOffsets Convert(IMacroStabilityInwardsLocationInput input) + { + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + return input.UseDefaultOffsets + ? new PhreaticLineOffsets() + : new PhreaticLineOffsets(input.PhreaticLineOffsetBelowDikeTopAtRiver, + input.PhreaticLineOffsetBelowDikeTopAtPolder, + input.PhreaticLineOffsetBelowDikeToeAtPolder, + input.PhreaticLineOffsetBelowShoulderBaseInside); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Converters/SoilProfileConverter.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Converters/SoilProfileConverter.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Converters/SoilProfileConverter.cs (revision cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c) @@ -0,0 +1,139 @@ +// 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 System.ComponentModel; +using System.Linq; +using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.Input; +using Ringtoets.MacroStabilityInwards.Primitives; + +namespace Ringtoets.MacroStabilityInwards.CalculatedInput.Converters +{ + /// + /// Converter to convert + /// into . + /// + public static class SoilProfileConverter + { + /// + /// Converts + /// into . + /// + /// The soil profile to convert. + /// The converted . + /// Thrown when + /// is null. + /// Thrown when + /// + /// is an invalid value. + /// Thrown when + /// + /// is a valid value but unsupported. + public static SoilProfile Convert(IMacroStabilityInwardsSoilProfileUnderSurfaceLine soilProfile) + { + if (soilProfile == null) + { + throw new ArgumentNullException(nameof(soilProfile)); + } + + IEnumerable layers = ConvertLayers(soilProfile.Layers); + IEnumerable preconsolidationStresses = ConvertPreconsolidationStresses(soilProfile.PreconsolidationStresses); + + return new SoilProfile(layers, preconsolidationStresses); + } + + /// + /// Converts + /// into . + /// + /// The layers to convert. + /// The converted . + /// Thrown when + /// + /// is an invalid value. + /// Thrown when + /// + /// is a valid value but unsupported. + private static IEnumerable ConvertLayers(IEnumerable layers) + { + return layers.Select(l => + { + IMacroStabilityInwardsSoilLayerData data = l.Data; + return new SoilLayer(l.OuterRing, l.Holes, new SoilLayer.ConstructionProperties + { + MaterialName = data.MaterialName, + UsePop = data.UsePop, + IsAquifer = data.IsAquifer, + ShearStrengthModel = ConvertShearStrengthModel(data.ShearStrengthModel), + AbovePhreaticLevel = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetAbovePhreaticLevel(data).GetDesignValue(), + BelowPhreaticLevel = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetBelowPhreaticLevel(data).GetDesignValue(), + Cohesion = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetCohesion(data).GetDesignValue(), + FrictionAngle = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetFrictionAngle(data).GetDesignValue(), + ShearStrengthRatio = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetShearStrengthRatio(data).GetDesignValue(), + StrengthIncreaseExponent = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetStrengthIncreaseExponent(data).GetDesignValue(), + Pop = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPop(data).GetDesignValue(), + DilatancyType = DilatancyType.Zero, + WaterPressureInterpolationModel = WaterPressureInterpolationModel.Automatic + }); + }).ToArray(); + } + + private static IEnumerable ConvertPreconsolidationStresses( + IEnumerable preconsolidationStresses) + { + return preconsolidationStresses.Select(ps => new PreconsolidationStress( + ps.Location, + MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPreconsolidationStress(ps).GetDesignValue())); + } + + /// + /// Converts a to a . + /// + /// The to convert. + /// A based on the information of . + /// Thrown when + /// is an invalid value. + /// Thrown when + /// is a valid value but unsupported. + private static ShearStrengthModel ConvertShearStrengthModel(MacroStabilityInwardsShearStrengthModel shearStrengthModel) + { + if (!Enum.IsDefined(typeof(MacroStabilityInwardsShearStrengthModel), shearStrengthModel)) + { + throw new InvalidEnumArgumentException(nameof(shearStrengthModel), + (int) shearStrengthModel, + typeof(MacroStabilityInwardsShearStrengthModel)); + } + + switch (shearStrengthModel) + { + case MacroStabilityInwardsShearStrengthModel.SuCalculated: + return ShearStrengthModel.SuCalculated; + case MacroStabilityInwardsShearStrengthModel.CPhi: + return ShearStrengthModel.CPhi; + case MacroStabilityInwardsShearStrengthModel.CPhiOrSuCalculated: + return ShearStrengthModel.CPhiOrSuCalculated; + default: + throw new NotSupportedException(); + } + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Ringtoets.MacroStabilityInwards.CalculatedInput.csproj =================================================================== diff -u -rb97a663a2997575c7c2cdabc4172866b4e6597f3 -rcfa7dc2bce5e37f5677d9c8772b68599f9e26a0c --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Ringtoets.MacroStabilityInwards.CalculatedInput.csproj (.../Ringtoets.MacroStabilityInwards.CalculatedInput.csproj) (revision b97a663a2997575c7c2cdabc4172866b4e6597f3) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Ringtoets.MacroStabilityInwards.CalculatedInput.csproj (.../Ringtoets.MacroStabilityInwards.CalculatedInput.csproj) (revision cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c) @@ -40,6 +40,9 @@ Properties\GlobalAssembly.cs + + + @@ -48,6 +51,28 @@ Copying.licenseheader + + + {3bbfd65b-b277-4e50-ae6d-bd24c3434609} + Core.Common.Base + False + + + {d4200f43-3f72-4f42-af0a-8ced416a38ec} + Ringtoets.Common.Data + False + + + {3C0D3B38-A9F7-4B22-9705-513DA26AE2CC} + Ringtoets.MacroStabilityInwards.KernelWrapper + False + + + {E9B39743-2DC9-4922-9E0F-6BA3E0E54189} + Ringtoets.MacroStabilityInwards.Primitives + False + + + \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/UpliftVanCalculatorInputAssert.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/UpliftVanCalculatorInputAssert.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/UpliftVanCalculatorInputAssert.cs (revision cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c) @@ -0,0 +1,104 @@ +// 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.Linq; +using NUnit.Framework; +using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.Input; +using Ringtoets.MacroStabilityInwards.Primitives; + +namespace Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil +{ + /// + /// Class for asserting Uplift Van calculator input. + /// + public static class UpliftVanCalculatorInputAssert + { + /// + /// Asserts whether corresponds to . + /// + /// The original . + /// The actual . + /// Thrown when + /// does not correspond to . + public static void AssertSoilProfile(IMacroStabilityInwardsSoilProfileUnderSurfaceLine original, SoilProfile actual) + { + IMacroStabilityInwardsSoilLayerUnderSurfaceLine[] expectedLayers = original.Layers.ToArray(); + SoilLayer[] actualLayers = actual.Layers.ToArray(); + + IMacroStabilityInwardsPreconsolidationStress[] expectedPreconsolidationStresses = original.PreconsolidationStresses.ToArray(); + PreconsolidationStress[] actualPreconsolidationStresses = actual.PreconsolidationStresses.ToArray(); + + AssertLayers(expectedLayers, actualLayers); + AssertPreconsolidationStresses(expectedPreconsolidationStresses, actualPreconsolidationStresses); + } + + /// + /// Asserts whether corresponds to . + /// + /// The original array. + /// The actual array. + /// Thrown when + /// does not correspond to . + private static void AssertPreconsolidationStresses(IMacroStabilityInwardsPreconsolidationStress[] original, + PreconsolidationStress[] actual) + { + Assert.AreEqual(original.Length, actual.Length); + for (var i = 0; i < original.Length; i++) + { + Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPreconsolidationStress(original[i]).GetDesignValue(), actual[i].Stress); + Assert.AreSame(original[i].Location, actual[i].Coordinate); + } + } + + /// + /// Asserts whether corresponds to . + /// + /// The original array. + /// The actual array. + /// Thrown when + /// does not correspond to . + private static void AssertLayers(IMacroStabilityInwardsSoilLayerUnderSurfaceLine[] original, SoilLayer[] actual) + { + Assert.AreEqual(original.Length, actual.Length); + + for (var i = 0; i < original.Length; i++) + { + Assert.AreSame(original[i].OuterRing, actual[i].OuterRing); + Assert.AreSame(original[i].Holes, actual[i].Holes); + + IMacroStabilityInwardsSoilLayerData expectedData = original[i].Data; + Assert.AreEqual(expectedData.MaterialName, actual[i].MaterialName); + Assert.AreEqual(expectedData.UsePop, actual[i].UsePop); + Assert.AreEqual(expectedData.IsAquifer, actual[i].IsAquifer); + Assert.AreEqual(DilatancyType.Zero, actual[i].DilatancyType); + Assert.AreEqual(WaterPressureInterpolationModel.Automatic, actual[i].WaterPressureInterpolationModel); + + Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetAbovePhreaticLevel(expectedData).GetDesignValue(), actual[i].AbovePhreaticLevel); + Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetBelowPhreaticLevel(expectedData).GetDesignValue(), actual[i].BelowPhreaticLevel); + Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetCohesion(expectedData).GetDesignValue(), actual[i].Cohesion); + Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetFrictionAngle(expectedData).GetDesignValue(), actual[i].FrictionAngle); + Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetStrengthIncreaseExponent(expectedData).GetDesignValue(), actual[i].StrengthIncreaseExponent); + Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetShearStrengthRatio(expectedData).GetDesignValue(), actual[i].ShearStrengthRatio); + Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPop(expectedData).GetDesignValue(), actual[i].Pop); + } + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/packages.config =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/packages.config (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/packages.config (revision cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c) @@ -0,0 +1,26 @@ + + + + + \ No newline at end of file Fisheye: Tag cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsSemiProbabilisticDesignVariableFactoryTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/Ringtoets.MacroStabilityInwards.Data.Test.csproj =================================================================== diff -u -r14c118039f313ea66787d8065daad0aa783b731a -rcfa7dc2bce5e37f5677d9c8772b68599f9e26a0c --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/Ringtoets.MacroStabilityInwards.Data.Test.csproj (.../Ringtoets.MacroStabilityInwards.Data.Test.csproj) (revision 14c118039f313ea66787d8065daad0aa783b731a) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/Ringtoets.MacroStabilityInwards.Data.Test.csproj (.../Ringtoets.MacroStabilityInwards.Data.Test.csproj) (revision cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c) @@ -66,7 +66,6 @@ - Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSemiProbabilisticDesignVariableFactoryTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSemiProbabilisticDesignVariableFactoryTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSemiProbabilisticDesignVariableFactoryTest.cs (revision cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c) @@ -0,0 +1,225 @@ +// 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.Data; +using Core.Common.Base.Geometry; +using NUnit.Framework; +using Ringtoets.Common.Data.Probabilistics; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.MacroStabilityInwards.Data.SoilProfile; + +namespace Ringtoets.MacroStabilityInwards.Primitives.Test +{ + [TestFixture] + public class MacroStabilityInwardsSemiProbabilisticDesignVariableFactoryTest + { + private Random random; + private double mean; + private double coefficientOfVariation; + + [SetUp] + public void Setup() + { + random = new Random(21); + mean = random.NextDouble(); + coefficientOfVariation = random.NextDouble(); + } + + [Test] + public void GetAbovePhreaticLevel_ValidSoilLayerData_CreateDesignVariableForAbovePhreaticLevel() + { + // Setup + var data = new MacroStabilityInwardsSoilLayerData + { + AbovePhreaticLevel = + { + Mean = (RoundedDouble) mean, + CoefficientOfVariation = (RoundedDouble) coefficientOfVariation, + Shift = (RoundedDouble) (mean - 0.1) + } + }; + + // Call + VariationCoefficientDesignVariable abovePhreaticLevel = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetAbovePhreaticLevel(data); + + // Assert + DistributionAssert.AreEqual(data.AbovePhreaticLevel, abovePhreaticLevel.Distribution); + AssertPercentile(0.5, abovePhreaticLevel); + } + + [Test] + public void GetBelowPhreaticLevel_ValidSoilLayerData_CreateDesignVariableForBelowPhreaticLevel() + { + // Setup + var data = new MacroStabilityInwardsSoilLayerData + { + BelowPhreaticLevel = + { + Mean = (RoundedDouble) mean, + CoefficientOfVariation = (RoundedDouble) coefficientOfVariation, + Shift = (RoundedDouble) (mean - 0.1) + } + }; + + // Call + VariationCoefficientDesignVariable belowPhreaticLevel = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetBelowPhreaticLevel(data); + + // Assert + DistributionAssert.AreEqual(data.BelowPhreaticLevel, belowPhreaticLevel.Distribution); + AssertPercentile(0.5, belowPhreaticLevel); + } + + [Test] + public void GetCohesion_ValidSoilLayerData_CreateDesignVariableForCohesion() + { + // Setup + var data = new MacroStabilityInwardsSoilLayerData + { + Cohesion = + { + Mean = (RoundedDouble) mean, + CoefficientOfVariation = (RoundedDouble) coefficientOfVariation + } + }; + + // Call + VariationCoefficientDesignVariable cohesion = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetCohesion(data); + + // Assert + DistributionAssert.AreEqual(data.Cohesion, cohesion.Distribution); + AssertPercentile(0.05, cohesion); + } + + [Test] + public void GetFrictionAngle_ValidSoilLayerData_CreateDesignVariableForFrictionAngle() + { + // Setup + var data = new MacroStabilityInwardsSoilLayerData + { + FrictionAngle = + { + Mean = (RoundedDouble) mean, + CoefficientOfVariation = (RoundedDouble) coefficientOfVariation + } + }; + + // Call + VariationCoefficientDesignVariable frictionAngle = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetFrictionAngle(data); + + // Assert + DistributionAssert.AreEqual(data.FrictionAngle, frictionAngle.Distribution); + AssertPercentile(0.05, frictionAngle); + } + + [Test] + public void GetShearStrengthRatio_ValidSoilLayerData_CreateDesignVariableForShearStrengthRatio() + { + // Setup + var data = new MacroStabilityInwardsSoilLayerData + { + ShearStrengthRatio = + { + Mean = (RoundedDouble) mean, + CoefficientOfVariation = (RoundedDouble) coefficientOfVariation + } + }; + + // Call + VariationCoefficientDesignVariable shearStrengthRatio = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetShearStrengthRatio(data); + + // Assert + DistributionAssert.AreEqual(data.ShearStrengthRatio, shearStrengthRatio.Distribution); + AssertPercentile(0.05, shearStrengthRatio); + } + + [Test] + public void GetStrengthIncreaseExponent_ValidSoilLayerData_CreateDesignVariableForStrengthIncreaseExponent() + { + // Setup + var data = new MacroStabilityInwardsSoilLayerData + { + StrengthIncreaseExponent = + { + Mean = (RoundedDouble) mean, + CoefficientOfVariation = (RoundedDouble) coefficientOfVariation + } + }; + + // Call + VariationCoefficientDesignVariable strengthIncreaseExponent = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetStrengthIncreaseExponent(data); + + // Assert + DistributionAssert.AreEqual(data.StrengthIncreaseExponent, strengthIncreaseExponent.Distribution); + AssertPercentile(0.05, strengthIncreaseExponent); + } + + [Test] + public void GetPop_ValidSoilLayerData_CreateDesignVariableForPop() + { + // Setup + var data = new MacroStabilityInwardsSoilLayerData + { + Pop = + { + Mean = (RoundedDouble) mean, + CoefficientOfVariation = (RoundedDouble) coefficientOfVariation + } + }; + + // Call + VariationCoefficientDesignVariable pop = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPop(data); + + // Assert + DistributionAssert.AreEqual(data.Pop, pop.Distribution); + AssertPercentile(0.05, pop); + } + + [Test] + public void GetPreconsolidationStress_ValidPreconsolidationStress_CreateDesignVariableForPreconsolidationStress() + { + // Setup + var location = new Point2D(random.NextDouble(), random.NextDouble()); + var stressDistribution = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 0.005, + CoefficientOfVariation = (RoundedDouble) coefficientOfVariation + }; + + var preconsolidationStress = new MacroStabilityInwardsPreconsolidationStress(location, stressDistribution); + + // Call + VariationCoefficientDesignVariable preconsoldationStress = + MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPreconsolidationStress(preconsolidationStress); + + // Assert + DistributionAssert.AreEqual(preconsolidationStress.Stress, preconsoldationStress.Distribution); + AssertPercentile(0.05, preconsoldationStress); + } + + private static void AssertPercentile(double percentile, VariationCoefficientDesignVariable designVariable) + { + Assert.IsInstanceOf(designVariable); + var percentileBasedDesignVariable = (VariationCoefficientLogNormalDistributionDesignVariable) designVariable; + Assert.AreEqual(percentile, percentileBasedDesignVariable.Percentile); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/Ringtoets.MacroStabilityInwards.Primitives.Test.csproj =================================================================== diff -u -r14c118039f313ea66787d8065daad0aa783b731a -rcfa7dc2bce5e37f5677d9c8772b68599f9e26a0c --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/Ringtoets.MacroStabilityInwards.Primitives.Test.csproj (.../Ringtoets.MacroStabilityInwards.Primitives.Test.csproj) (revision 14c118039f313ea66787d8065daad0aa783b731a) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/Ringtoets.MacroStabilityInwards.Primitives.Test.csproj (.../Ringtoets.MacroStabilityInwards.Primitives.Test.csproj) (revision cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c) @@ -54,6 +54,7 @@ + @@ -82,6 +83,14 @@ {d4200f43-3f72-4f42-af0a-8ced416a38ec} Ringtoets.Common.Data + + {4843D6E5-066F-4795-94F5-1D53932DD03C} + Ringtoets.Common.Data.TestUtil + + + {83D6B73E-91D5-46B0-9218-955DA1F75F7C} + Ringtoets.MacroStabilityInwards.Data + {E9B39743-2DC9-4922-9E0F-6BA3E0E54189} Ringtoets.MacroStabilityInwards.Primitives Fisheye: Tag cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/Converters/DrainageConstructionConverterTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/Converters/PhreaticLineOffsetsConverterTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/Converters/SoilProfileConverterTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs =================================================================== diff -u -r90a9502badff5788374461a1b2179a5dd0e866a2 -rcfa7dc2bce5e37f5677d9c8772b68599f9e26a0c --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs (.../MacroStabilityInwardsCalculationServiceTest.cs) (revision 90a9502badff5788374461a1b2179a5dd0e866a2) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs (.../MacroStabilityInwardsCalculationServiceTest.cs) (revision cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c) @@ -28,6 +28,7 @@ using NUnit.Framework; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Service.TestUtil; +using Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil; using Ringtoets.MacroStabilityInwards.Data; using Ringtoets.MacroStabilityInwards.Data.TestUtil; using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators; @@ -37,7 +38,6 @@ using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan.Output; using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Calculators; using Ringtoets.MacroStabilityInwards.Primitives; -using Ringtoets.MacroStabilityInwards.Service.TestUtil; namespace Ringtoets.MacroStabilityInwards.Service.Test { Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/Ringtoets.MacroStabilityInwards.Service.Test.csproj =================================================================== diff -u -r484ac98127f04b1d315c98fdada7bd9f5a004872 -rcfa7dc2bce5e37f5677d9c8772b68599f9e26a0c --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/Ringtoets.MacroStabilityInwards.Service.Test.csproj (.../Ringtoets.MacroStabilityInwards.Service.Test.csproj) (revision 484ac98127f04b1d315c98fdada7bd9f5a004872) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/Ringtoets.MacroStabilityInwards.Service.Test.csproj (.../Ringtoets.MacroStabilityInwards.Service.Test.csproj) (revision cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c) @@ -62,10 +62,7 @@ - - - @@ -115,6 +112,10 @@ {55be9a1b-68ab-488f-af20-e037a50063db} Ringtoets.MacroStabilityInwards.Service + + {53F7C73E-6D85-4B90-A6A8-DAA7F4BCB071} + Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil + {2b78cf04-4785-4f27-a6e5-45bddbb7bf04} Ringtoets.MacroStabilityInwards.Data.TestUtil @@ -123,10 +124,6 @@ {3810D738-6412-47D1-8BC0-729D55BC951F} Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil - - {F966AE28-DE6B-497A-8449-37EC607E9F69} - Ringtoets.MacroStabilityInwards.Service.TestUtil - Fisheye: Tag cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.TestUtil/Properties/AssemblyInfo.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.TestUtil/Ringtoets.MacroStabilityInwards.Service.TestUtil.csproj'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.TestUtil/UpliftVanCalculatorInputAssert.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.TestUtil/packages.config'. Fisheye: No comparison available. Pass `N' to diff?