Index: DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/Factories/FactoryForSoilProfiles.cs =================================================================== diff -u -r5386 -r5404 --- DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/Factories/FactoryForSoilProfiles.cs (.../FactoryForSoilProfiles.cs) (revision 5386) +++ DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/Factories/FactoryForSoilProfiles.cs (.../FactoryForSoilProfiles.cs) (revision 5404) @@ -112,7 +112,7 @@ /// Create two layer soil profile with pleistocene sand layer only /// /// soil profile - public static SoilProfile1D CreateClaySandProfile() + public static SoilProfile1D CreateClaySandProfile(double topLevelSandLayer = -5) { var soilProfile = new SoilProfile1D(); @@ -130,7 +130,7 @@ { Name = GetNewUniqueLayerId(soilProfile) }; - layer.TopLevel = -5.0; + layer.TopLevel = topLevelSandLayer; layer.Soil = new Soil("Alg-zand (0-30)", 22.0, 20.0); layer.Soil.DryUnitWeight = 0.01; layer.IsAquifer = true; @@ -1195,8 +1195,99 @@ return soilProfile2D; } -private static string GetNewUniqueLayerId(SoilProfile1D soilProfile1D) + + + public static SoilProfile1D CreateSoilProfile1DWithTwoClustersOfInBetweenAquifers(out SurfaceLine2 surfaceLine) { + const double topLevel = 1.212; + surfaceLine = new SurfaceLine2(); + surfaceLine.EnsurePointOfType(0, topLevel, CharacteristicPointType.SurfaceLevelOutside); + surfaceLine.EnsurePointOfType(25, topLevel, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(50, topLevel, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(75, topLevel, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, topLevel, CharacteristicPointType.SurfaceLevelInside); + + var soilProfile1D = new SoilProfile1D + { + BottomLevel = -30.0 + }; + + var layer = new SoilLayer1D + { + Name = "L1a", + TopLevel = topLevel, + IsAquifer = true // aquifer at top + }; + soilProfile1D.Layers.Add(layer); + layer = new SoilLayer1D + { + Name = "L1b", + TopLevel = 0, + IsAquifer = false + }; + soilProfile1D.Layers.Add(layer); + layer = new SoilLayer1D + { + Name = "L2a", + TopLevel = -2.111, // top of highest in-between aquifer + IsAquifer = true + }; + soilProfile1D.Layers.Add(layer); + layer = new SoilLayer1D + { + Name = "L2b", + TopLevel = -2.151, + IsAquifer = true + }; + soilProfile1D.Layers.Add(layer); + layer = new SoilLayer1D + { + Name = "L3", + TopLevel = -3.373, + IsAquifer = false + }; + soilProfile1D.Layers.Add(layer); + layer = new SoilLayer1D + { + Name = "L4", + TopLevel = -4.151, // top of lowest in-between aquifer + IsAquifer = true + }; + soilProfile1D.Layers.Add(layer); + layer = new SoilLayer1D + { + Name = "L5", + TopLevel = -5.373, + IsAquifer = false + }; + soilProfile1D.Layers.Add(layer); + layer = new SoilLayer1D + { + Name = "L6a", + TopLevel = -6.111, // top of bottom aquifer + IsAquifer = true + }; + soilProfile1D.Layers.Add(layer); + layer = new SoilLayer1D + { + Name = "L6b", + TopLevel = -6.151, + IsAquifer = true + }; + soilProfile1D.Layers.Add(layer); + layer = new SoilLayer1D + { + Name = "L7", + TopLevel = -7.373, + IsAquifer = false + }; + soilProfile1D.Layers.Add(layer); + + return soilProfile1D; + } + + private static string GetNewUniqueLayerId(SoilProfile1D soilProfile1D) + { var num = 0; string id; do Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs =================================================================== diff -u -r5391 -r5404 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs (.../PlLinesToWaternetConverterTests.cs) (revision 5391) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs (.../PlLinesToWaternetConverterTests.cs) (revision 5404) @@ -21,7 +21,6 @@ using System; using System.Collections.Generic; -using System.Data; using System.Globalization; using System.IO; using System.Linq; @@ -48,7 +47,6 @@ private static readonly Random random = new(21); private static readonly double leftCoordinate = random.NextDouble(); private static readonly double rightCoordinate = leftCoordinate + 1; - private static readonly double middleXCoordinate = 0.5 * (leftCoordinate + rightCoordinate); [Test] [TestCase(10, -5, 10, 10)] @@ -128,7 +126,7 @@ public void GivenPlLinesFullyDefinedAtOrBelowBottomSoil1DProfile_WhenCreatingWaternetBasedOnPlLinesAnd1DSoilProfile_ThenReturnsEmptyWaternet(double offsetFromBottomOfProfile) { // Setup - SoilProfile1D soilProfile = CreateSoilProfile1DWithTwoClustersOfInBetweenAquifers(out SurfaceLine2 surfaceLine); + SoilProfile1D soilProfile = FactoryForSoilProfiles.CreateSoilProfile1DWithTwoClustersOfInBetweenAquifers(out SurfaceLine2 surfaceLine); double bottomLevel = soilProfile.BottomLevel; double plLineZCoordinate = bottomLevel - offsetFromBottomOfProfile; @@ -164,7 +162,7 @@ public class Given1DSoilProfileWithTwoClustersOfInBetweenAquifers { private static SurfaceLine2 surfaceLine; - private readonly SoilProfile1D soilProfile1D = CreateSoilProfile1DWithTwoClustersOfInBetweenAquifers(out surfaceLine); + private readonly SoilProfile1D soilProfile1D = FactoryForSoilProfiles.CreateSoilProfile1DWithTwoClustersOfInBetweenAquifers(out surfaceLine); [TestCase(IntrusionVerticalWaterPressureType.Standard, -2.110, 6)] [TestCase(IntrusionVerticalWaterPressureType.Linear, 1.212, 6)] @@ -349,7 +347,7 @@ public void GivenNullPlLines_WhenCreatingWaternetBasedOnPlLinesAnd1DSoilProfile_ThenReturnsNoHeadLines() { PlLines plLines = CreateAllPlLines(); - SoilProfile1D soilProfile1D = CreateSoilProfile1DWithTwoClustersOfInBetweenAquifers(out SurfaceLine2 surfaceLine); + SoilProfile1D soilProfile1D = FactoryForSoilProfiles.CreateSoilProfile1DWithTwoClustersOfInBetweenAquifers(out SurfaceLine2 surfaceLine); Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile1D, surfaceLine, 0.5, IntrusionVerticalWaterPressureType.SemiTimeDependent); // head lines Assert.That(waternet.HeadLineList, Has.Count.EqualTo(3)); @@ -376,45 +374,6 @@ }); } - [Test] - [SetUICulture("en-EN")] - public void Given1DSoilProfileWithoutAquifer_WhenCreatingWaternetBasedOnPlLinesAnd1DSoilProfile_ThenReturnsException() - { - PlLines plLines = CreateAllPlLines(); - SoilProfile1D soilProfile1D = CreateSoilProfile1DWithTwoClustersOfInBetweenAquifers(out SurfaceLine2 surfaceLine); - const double penetrateLength = 2.1; - Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile1D, surfaceLine, penetrateLength, IntrusionVerticalWaterPressureType.SemiTimeDependent); - Assert.Multiple(() => - { - Assert.That(waternet.HeadLineList, Has.Count.EqualTo(3)); - Assert.That(waternet.WaternetLineList, Has.Count.EqualTo(7)); - }); - - // check that no waternet lines are added for pl4 when InBetweenAquiferLayer is null - soilProfile1D = CreateSoilProfile1DWith1AquiferForTest(); - waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile1D, surfaceLine, penetrateLength, IntrusionVerticalWaterPressureType.SemiTimeDependent); - Assert.Multiple(() => - { - Assert.That(waternet.HeadLineList, Has.Count.EqualTo(3)); - Assert.That(waternet.WaternetLineList, Has.Count.EqualTo(3)); - }); - Assert.Multiple(() => - { - // expected waternet line 0 is connected to pl2 with level -6.111 + 2.1 = -4.011 - Assert.That(waternet.WaternetLineList[1].HeadLine, Is.EqualTo(waternet.HeadLineList[0])); - Assert.That(waternet.WaternetLineList[1].Points[0].Z, Is.EqualTo(-4.011).Within(precision3Decimals)); - // expected waternet line 1 is connected to pl3 with level -6.111 - Assert.That(waternet.WaternetLineList[2].HeadLine, Is.EqualTo(waternet.HeadLineList[1])); - Assert.That(waternet.WaternetLineList[2].Points[0].Z, Is.EqualTo(-6.111).Within(precision3Decimals)); - }); - - // check that an exception is raised when no aquifer present - soilProfile1D = CreateSoilProfile1DWithoutAquifersForTest(); - Assert.That(() => PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile1D, surfaceLine, penetrationLength, IntrusionVerticalWaterPressureType.Standard), - Throws.InstanceOf().With.Message.EqualTo("The deepest layer is not an aquifer in soilprofile 'DefaultNameSoilProfile1D'.")); - - } - public class Given2DSoilProfileWithTwoClustersOfInBetweenAquifersAndVerticalLayerSeparations { private readonly SoilProfile2D soilProfile = Create2DSoilProfileWithTwoClustersOfInBetweenAquifersAndVerticalLayerSeparations(); @@ -631,130 +590,8 @@ }); } - /// - /// --------------------------------------------------- Level 0 m - /// - /// |------------------------- Level -5 m - /// top layer | right aquifer - /// |------------------------- Level -9 m - /// - /// -------------------------|------------------------- Level -10 m - /// left aquifer | - /// -------------------------| Level -20 m - /// + [Test] - [SetUICulture("nl-NL")] - public void CreateWaternetBasedOnPlLines_ValidPLLinesAndSoilProfile2DWithDiscontinuousBottomAquiferLayer_ReturnsException() - { - // Setup - SoilLayer2D soilLayer = CreateRectangularSoilLayer2D(0, -10, leftCoordinate, rightCoordinate, false); - SoilLayer2D soilLayerAquiferPartOne = CreateRectangularSoilLayer2D(-10, -20, leftCoordinate, middleXCoordinate, true); - SoilLayer2D soilLayerAquiferPartTwo = CreateRectangularSoilLayer2D(-5, -9, middleXCoordinate, rightCoordinate, true); - var soilProfile = new SoilProfile2D - { - Geometry = new GeometryData - { - Left = leftCoordinate, - Right = rightCoordinate, - Bottom = -20 - }, - Name = "SoilProfileTest" - }; - soilProfile.Surfaces.Add(soilLayer); - soilProfile.Surfaces.Add(soilLayerAquiferPartOne); - soilProfile.Surfaces.Add(soilLayerAquiferPartTwo); - - PlLines plLines = CreateAllPlLines(); - - // Call and assert - Assert.That(() => PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.Standard), - Throws.InstanceOf().With.Message.EqualTo("De onderste laag is geen watervoerende laag in grondprofiel 'SoilProfileTest'.")); - - } - - /// - /// --------------------------------------------------- Level 0 m - /// top layer - /// -------------------------|------------------------- Level -10 m - /// bottom layer left | bottom layer right - /// -------------------------|------------------------- Level -20 m - /// - [Test] - [SetUICulture("nl-NL")] - [TestCase(true, false)] - [TestCase(false, true)] - public void CreateWaternetBasedOnPlLines_ValidPLLinesAndSoilProfile2DWithBottomAquiferLayerNotSpanningWholeInterval_ReturnsException( - bool isLeftBottomLayerAquifer, bool isRightBottomLayerAquifer) - { - // Setup - SoilLayer2D soilLayer = CreateRectangularSoilLayer2D(0, -10, leftCoordinate, rightCoordinate, false); - SoilLayer2D soilLayerAquiferPartOne = CreateRectangularSoilLayer2D(-10, -20, leftCoordinate, middleXCoordinate, isLeftBottomLayerAquifer); - SoilLayer2D soilLayerAquiferPartTwo = CreateRectangularSoilLayer2D(-10, -20, middleXCoordinate, rightCoordinate, isRightBottomLayerAquifer); - - var soilProfile = new SoilProfile2D - { - Geometry = new GeometryData - { - Left = leftCoordinate, - Right = rightCoordinate, - Bottom = -20 - }, - Name = "SoilProfileTest" - }; - soilProfile.Surfaces.Add(soilLayer); - soilProfile.Surfaces.Add(soilLayerAquiferPartOne); - soilProfile.Surfaces.Add(soilLayerAquiferPartTwo); - - PlLines plLines = CreateAllPlLines(); - - // Call and assert - Assert.That(() => PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.Standard), - Throws.InstanceOf().With.Message.EqualTo("De onderste laag is geen watervoerende laag in grondprofiel 'SoilProfileTest'.")); - - } - - [Test] - [SetUICulture("nl-NL")] - public void GivenSoilProfile1DIsNull_WhenCreatingWaternetBasedOnPlLinesAndOn1DProfile_ThenLanguageNLThrowsException() - { - var plLines = new PlLines(); - Assert.That(() => PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, null, null, 0, IntrusionVerticalWaterPressureType.Standard), Throws.InstanceOf().With.Message.EqualTo("Geen ondergrond profiel gedefinieerd")); - } - - [Test] - [SetUICulture("nl-NL")] - public void GivenPlLinesIsNull_WhenCreatingWaternetBasedOnPlLinesAndOn1DProfile_ThenLanguageNLThrowsException() - { - var soilProfile1D = new SoilProfile1D(); - Assert.That(() => PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(null, soilProfile1D, null, 0, IntrusionVerticalWaterPressureType.Standard), Throws.InstanceOf().With.Message.EqualTo("Geen object voor pn-lijnen gedefinieerd")); - } - - [Test] - [SetUICulture("nl-NL")] - public void GivenSurfaceLineIsNull_WhenCreatingWaternetBasedOnPlLinesAndOn1DProfile_ThenLanguageNLThrowsException() - { - var soilProfile1D = new SoilProfile1D(); - var plLines = new PlLines(); - Assert.That(() => PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile1D, null, 0, IntrusionVerticalWaterPressureType.Standard), Throws.InstanceOf().With.Message.EqualTo("Geen object voor maaiveld gedefinieerd")); - } - - [Test] - [SetUICulture("nl-NL")] - public void GivenSoilProfile2DIsNull_WhenCreatingWaternetBasedOnPlLinesAnd2DProfile_ThenLanguageNLThrowsException() - { - var plLines = new PlLines(); - Assert.That(() => PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, null, 0, IntrusionVerticalWaterPressureType.Standard), Throws.InstanceOf().With.Message.EqualTo("Geen ondergrond profiel gedefinieerd")); - } - - [Test] - [SetUICulture("nl-NL")] - public void GivenPlLinesIsNull_WhenCreatingWaternetBasedOnPlLinesAndOn2DProfile_ThenLanguageNLThrowsException() - { - var soilProfile = new SoilProfile2D(); - Assert.That(() => PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(null, soilProfile, 0, IntrusionVerticalWaterPressureType.Standard), Throws.InstanceOf().With.Message.EqualTo("Geen object voor pn-lijnen gedefinieerd")); - } - - [Test] public void Given2DProfileDWP1AndPl1FromTutorialStability_WhenCreatingTheWaternetLineForPL1ForDAMStandard_ThenExpectedWaternetLineReturned() { // Setup @@ -1011,136 +848,7 @@ Assert.That(waternetLine.Points[5].Z, Is.EqualTo(-10).Within(precision3Decimals)); }); } - - private static SoilProfile1D CreateSoilProfile1DWithTwoClustersOfInBetweenAquifers(out SurfaceLine2 surfaceLine) - { - const double topLevel = 1.212; - surfaceLine = new SurfaceLine2(); - surfaceLine.EnsurePointOfType(0, topLevel, CharacteristicPointType.SurfaceLevelOutside); - surfaceLine.EnsurePointOfType(100, topLevel, CharacteristicPointType.SurfaceLevelInside); - var soilProfile1D = new SoilProfile1D - { - BottomLevel = -30.0 - }; - - var layer = new SoilLayer1D - { - Name = "L1a", - TopLevel = topLevel, - IsAquifer = true // aquifer at top - }; - soilProfile1D.Layers.Add(layer); - layer = new SoilLayer1D - { - Name = "L1b", - TopLevel = 0, - IsAquifer = false - }; - soilProfile1D.Layers.Add(layer); - layer = new SoilLayer1D - { - Name = "L2a", - TopLevel = -2.111, // top of highest in-between aquifer - IsAquifer = true - }; - soilProfile1D.Layers.Add(layer); - layer = new SoilLayer1D - { - Name = "L2b", - TopLevel = -2.151, - IsAquifer = true - }; - soilProfile1D.Layers.Add(layer); - layer = new SoilLayer1D - { - Name = "L3", - TopLevel = -3.373, - IsAquifer = false - }; - soilProfile1D.Layers.Add(layer); - layer = new SoilLayer1D - { - Name = "L4", - TopLevel = -4.151, // top of lowest in-between aquifer - IsAquifer = true - }; - soilProfile1D.Layers.Add(layer); - layer = new SoilLayer1D - { - Name = "L5", - TopLevel = -5.373, - IsAquifer = false - }; - soilProfile1D.Layers.Add(layer); - layer = new SoilLayer1D - { - Name = "L6a", - TopLevel = -6.111, // top of bottom aquifer - IsAquifer = true - }; - soilProfile1D.Layers.Add(layer); - layer = new SoilLayer1D - { - Name = "L6b", - TopLevel = -6.151, - IsAquifer = true - }; - soilProfile1D.Layers.Add(layer); - layer = new SoilLayer1D - { - Name = "L7", - TopLevel = -7.373, - IsAquifer = false - }; - soilProfile1D.Layers.Add(layer); - - return soilProfile1D; - } - - private static SoilProfile1D CreateSoilProfile1DWith1AquiferForTest() - { - var soilProfile1D = new SoilProfile1D - { - BottomLevel = -30.0 - }; - - var layer = new SoilLayer1D - { - Name = "L1b", - TopLevel = 1.212, - IsAquifer = false - }; - soilProfile1D.Layers.Add(layer); - layer = new SoilLayer1D - { - Name = "L6a", - TopLevel = -6.111, // top of bottom aquifer - IsAquifer = true - }; - soilProfile1D.Layers.Add(layer); - - return soilProfile1D; - } - - private static SoilProfile1D CreateSoilProfile1DWithoutAquifersForTest() - { - var soilProfile1D = new SoilProfile1D - { - BottomLevel = -30.0 - }; - - var layer = new SoilLayer1D - { - Name = "L1b", - TopLevel = 1.212, - IsAquifer = false - }; - soilProfile1D.Layers.Add(layer); - - return soilProfile1D; - } - private static SoilLayer2D CreateSoilLayer2D(Point2D topLeftCoordinate, Point2D topRightCoordinate, Point2D bottomRightCoordinate, Point2D bottomLeftCoordinate, bool isAquifer) { Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/DamPipingHelper.cs =================================================================== diff -u -r4540 -r5404 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/DamPipingHelper.cs (.../DamPipingHelper.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/DamPipingHelper.cs (.../DamPipingHelper.cs) (revision 5404) @@ -65,16 +65,11 @@ SoilProfile1D soilProfile = damKernelInput.SubSoilScenario.SoilProfile1D; SurfaceLine2 surfaceLine = damKernelInput.Location.SurfaceLine; - ThrowHelper.ThrowWhenConditionIsTrue( - string.Format(Resources.NoSoilProfile1DDefinedForLocation, location.Name), - () => (soilProfile == null || soilProfile.Layers.Count < 1)); - ThrowHelper.ThrowIfArgumentNull(soilProfile, string.Format(Resources.NoSurfaceLineDefinedForLocation, location.Name)); - + // The validation of the soilProfile will be performed in CreatePlLinesForPiping by calling the SoilProfileValidator. + // Here only the presence of point DikeToeAtRiver is checked because it is not done in SoilProfileValidator. GeometryPoint entryPoint = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver); - ThrowHelper.ThrowIfArgumentNull(entryPoint, string.Format(Resources.NoDikeToeDefinedForLocation, location.Name)); - ThrowHelper.ThrowIfArgumentNull(soilProfile.BottomAquiferLayer, string.Format(Resources.NoBottomAquiferLayer, soilProfile.Name)); - + plLines = PlLinesHelper.CreatePlLinesForPiping(damKernelInput.TimeStepDateTime, damKernelInput.Location, damKernelInput.SubSoilScenario.SoilProfile1D, damKernelInput.RiverLevelHigh); Index: DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/Factories/FactoryForSurfaceLines.cs =================================================================== diff -u -r5261 -r5404 --- DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/Factories/FactoryForSurfaceLines.cs (.../FactoryForSurfaceLines.cs) (revision 5261) +++ DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/Factories/FactoryForSurfaceLines.cs (.../FactoryForSurfaceLines.cs) (revision 5404) @@ -321,6 +321,9 @@ }; surfaceLine.EnsurePointOfType(left, level, CharacteristicPointType.SurfaceLevelOutside); + surfaceLine.EnsurePointOfType(left + (right - left) / 4, level, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(left + (right - left) / 2, level, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(right - (right - left) / 4, level, CharacteristicPointType.DikeToeAtPolder); surfaceLine.EnsurePointOfType(right, level, CharacteristicPointType.SurfaceLevelInside); surfaceLine.Geometry.SyncCalcPoints(); Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/Common/UpliftHelperTests.cs =================================================================== diff -u -r5380 -r5404 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/Common/UpliftHelperTests.cs (.../UpliftHelperTests.cs) (revision 5380) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/Common/UpliftHelperTests.cs (.../UpliftHelperTests.cs) (revision 5404) @@ -23,7 +23,6 @@ using Deltares.DamEngine.Calculators.KernelWrappers.Common; using Deltares.DamEngine.Calculators.Tests.KernelWrappers.TestHelpers; using Deltares.DamEngine.Data.General; -using Deltares.DamEngine.Data.General.PlLines; using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.TestHelpers.Factories; using NUnit.Framework; Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Interfaces/IKernelDataOutput.cs =================================================================== diff -u -r4540 -r5404 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Interfaces/IKernelDataOutput.cs (.../IKernelDataOutput.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Interfaces/IKernelDataOutput.cs (.../IKernelDataOutput.cs) (revision 5404) @@ -22,6 +22,6 @@ namespace Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; /// -/// Interface for generic outpu for Failure mechanims wrapper +/// Interface for generic output for Failure mechanism wrapper /// public interface IKernelDataOutput {} \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx =================================================================== diff -u -r5033 -r5404 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 5033) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 5404) @@ -142,17 +142,8 @@ Location '{0}', subsoil scenario '{1}', design scenario '{2}': The preparation for this calculation failed. - No toe of dike has been defined in the surfaceline for location '{0}'. + No toe of dike has been defined in the surfaceline for location '{0}'. - - No 1D soilprofile has been defined for location '{0}'. - - - No surfaceline has been defined for location '{0}'. - - - The deepest layer is not an aquifer in soilprofile '{0}'. - Specified z-level {0} in AquitardEvaluator is outside soilprofile '{1}' (should be between {2} and {3}). @@ -274,9 +265,30 @@ No pl-lines object defined - - No surface line object defined + + No calculation is performed for this scenario because the geometry does not comply with the demands posed on the creation of the waternet: + + No surface line defined. + + + At least two surface line points are required. + + + At least one of the following required characteristic point is missing: Dike top at river, Dike top at polder, Dike toe at polder. + + + Not enough soil geometry information (SoilProfile1D, SoilProfile2D or DikeEmbankmentMaterial) available for the PL-line creator. + + + The deepest layer is not a (continuous) aquifer in soil profile '{0}'. + + + The soil profile contains no aquifer layer at all. + + + The soil profile contains no aquitard layer at all. + An unexpected error occured during the determination of the top and bottom boundaries of the in-between aquifer layer. @@ -285,5 +297,5 @@ Location {0} Profile {1} Scenario {2} is not relevant (different calculator or no uplift at using piping or stability UpliftVan). - + \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx =================================================================== diff -u -r5033 -r5404 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 5033) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 5404) @@ -165,9 +165,6 @@ Niet alle benodigde data is aanwezig - - De onderste laag is geen watervoerende laag in grondprofiel '{0}'. - Er is geen teen van de dijk voor de hoogtegeometrie gedfinieerd in locatie '{0}'. @@ -270,9 +267,30 @@ Geen ondergrond profiel gedefinieerd - - Geen object voor maaiveld gedefinieerd + + Voor dit scenario wordt geen berekening uitgevoerd omdat het ondergrondprofiel niet voldoet aan de eisen die aan de aanleg van het waternet worden gesteld: + + Geen hoogtegeometrie gedefinieerd. + + + Ten minste twee hoogtegeometrie punten zijn vereist. + + + Er ontbreekt tenminste één van de volgende verplichte karakteristieke punten: Kruin buitentalud, Kruin binnentalud, Teen dijk binnenwaarts. + + + Er is niet voldoende informatie over het ondergrondprofiel (Profiel 1D, Profiel 2D of Ophoogmateriaal dijk) beschikbaar voor de PL-lijnen te maken. + + + De onderste laag is geen (continue) watervoerende laag in ondergrondprofiel '{0}'. + + + Het ondergrondprofiel bevat helemaal geen watervoerende laag. + + + Het ondergrondprofiel bevat helemaal geen waterkerende laag. + Er is een onverwachte fout opgetreden bij het bepalen van de boven- en ondergrenzen van de tussenliggende watervoerende laag. Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs =================================================================== diff -u -r5380 -r5404 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 5380) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 5404) @@ -61,15 +61,11 @@ public SoilProfileType SoilProfileType { get; set; } public SoilProfile1D SoilProfile { get; set; } - public SoilProfile2D SoilProfile2D { get; set; } - public string SoilGeometry2DName { get; set; } public Soil DikeEmbankmentMaterial { get; set; } - public SoilList SoilList { get; set; } public double? HeadInPlLine2 { get; set; } - public double XSoilGeometry2DOrigin { get; set; } public bool IsAdjustPL3AndPL4SoNoUpliftWillOccurEnabled { get; set; } = true; public double WaterLevelRiverHigh { get; set; } @@ -211,7 +207,7 @@ /// /// /// - public PlLinePoint DetermineIntersectionBetweenWaterLevelAndDike(double waterLevelRiver) + private PlLinePoint DetermineIntersectionBetweenWaterLevelAndDike(double waterLevelRiver) { GeometryPoint pointAtLevel = SurfaceLine.DetermineIntersectionWithLevel(waterLevelRiver); if (pointAtLevel != null) @@ -493,8 +489,8 @@ } /// - /// Continue PlLine to the end with a slope of slopegradient - /// If PlLine is lower then polderlevel, continue with polderlevel + /// Continue PlLine to the end with a slope of slope gradient + /// If PlLine is lower than polder level, continue with polder level /// /// The slope gradient. /// The pl line. @@ -965,6 +961,8 @@ /// private PlLines CreateAllPlLinesWithExpertKnowledge(Location location) { + ValidateSoilProfileForPlLinesCreation(); + var plLines = new PlLines(); foreach (PlLineType plLineType in Enum.GetValues(typeof(PlLineType))) { @@ -1133,27 +1131,6 @@ } /// - /// Validate of all required characteristic points exists - /// - private void ValidateRequiredCharacteristicPoints() - { - if (!SurfaceLine.HasAnnotation(CharacteristicPointType.DikeTopAtRiver)) - { - throw new PlLinesCreatorException("Required characteristic point DikeTopAtRiver not found. "); - } - - if (!SurfaceLine.HasAnnotation(CharacteristicPointType.DikeTopAtPolder)) - { - throw new PlLinesCreatorException("Required characteristic point DikeTopAtPolder not found. "); - } - - if (!SurfaceLine.HasAnnotation(CharacteristicPointType.DikeToeAtPolder)) - { - throw new PlLinesCreatorException("Required characteristic point DikeToeAtPolder not found. "); - } - } - - /// /// /// /// @@ -1665,10 +1642,6 @@ /// private PlLine CreatePlLine1ByExpertKnowledge() { - ValidateSurfaceLine(); - - ValidateRequiredCharacteristicPoints(); - ThrowWhenWaterLevelPolderAboveDikeTopAtPolder(); //Create Phreatic line and add polderwater level @@ -1719,22 +1692,6 @@ } /// - /// Check whether a correct surface line has been imported - /// - private void ValidateSurfaceLine() - { - if (SurfaceLine == null) - { - throw new PlLinesCreatorException("Surfaceline should be initialized"); - } - - if (SurfaceLine.Geometry.Points.Count < 2) - { - throw new PlLinesCreatorException("More surfaceline points are required"); - } - } - - /// /// Check if phreatic line is above waterlevel /// If it is below, correct it /// @@ -1787,4 +1744,21 @@ throw new PlLinesCreatorException($"Waterlevel ({WaterLevelPolder:0.00}) in polder higher than dike top at polder ({dikeTopPolder:0.00}) in surfaceline {SurfaceLine.Name}"); } } + + private void ValidateSoilProfileForPlLinesCreation() + { + var validator = new SoilProfileValidator + { + SurfaceLine = SurfaceLine, + SoilProfileType = SoilProfileType, + SoilProfile1D = SoilProfile, + SoilProfile2D = SoilProfile2D, + SoilGeometry2DName = SoilGeometry2DName, + DikeEmbankmentMaterial = DikeEmbankmentMaterial + }; + + validator.ValidateSoilProfileForPlLinesCreator(); + + + } } \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/PlLinesHelper.cs =================================================================== diff -u -r5380 -r5404 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/PlLinesHelper.cs (.../PlLinesHelper.cs) (revision 5380) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/PlLinesHelper.cs (.../PlLinesHelper.cs) (revision 5404) @@ -33,7 +33,7 @@ /// /// Helper for Pl Lines /// -public class PlLinesHelper +public static class PlLinesHelper { /// /// Creates the pl lines. Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/UpliftHelper.cs =================================================================== diff -u -r5380 -r5404 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/UpliftHelper.cs (.../UpliftHelper.cs) (revision 5380) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/UpliftHelper.cs (.../UpliftHelper.cs) (revision 5404) @@ -66,7 +66,7 @@ /// The location. /// The sub soil scenario. /// true if there is uplift - public bool DetermineIsUplift(PlLines plLines, Location location, SoilGeometryProbability subSoilScenario) + private bool DetermineIsUplift(PlLines plLines, Location location, SoilGeometryProbability subSoilScenario) { if (plLines == null) { Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/TestHelpers/DamEngineDataTestFactory.cs =================================================================== diff -u -r4540 -r5404 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/TestHelpers/DamEngineDataTestFactory.cs (.../DamEngineDataTestFactory.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/TestHelpers/DamEngineDataTestFactory.cs (.../DamEngineDataTestFactory.cs) (revision 5404) @@ -23,6 +23,7 @@ using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Geotechnics; +using Deltares.DamEngine.TestHelpers.Factories; namespace Deltares.DamEngine.Calculators.Tests.KernelWrappers.TestHelpers; @@ -224,72 +225,22 @@ geometry.Bottom = -10; soilProfile2D.Geometry = geometry; - var layer = new SoilLayer2D - { - Name = "Layer 1" - }; + SoilLayer2D layer = FactoryForSoilProfiles.CreateRectangularSoilLayer2D(1, -5, 0, 100, null, soilProfile2D, true); + layer.Name = "Layer 1"; layer.Soil = soiList != null ? soiList.GetSoilByName("OA") : new Soil("OA", 18, 17); layer.Soil.ShearStrengthModel = ShearStrengthModel.CPhi; - var outerLoop = new GeometryLoop(); - var point1 = new Point2D(0, 1); - geometry.Points.Add(point1); - var point2 = new Point2D(100, 1); - geometry.Points.Add(point2); - var point3 = new Point2D(100, -5); - geometry.Points.Add(point3); - var point4 = new Point2D(0, -5); - geometry.Points.Add(point4); - var curve1 = new GeometryCurve(point1, point2); - geometry.Curves.Add(curve1); - outerLoop.CurveList.Add(curve1); - var curve2 = new GeometryCurve(point2, point3); - geometry.Curves.Add(curve2); - outerLoop.CurveList.Add(curve2); - var curve3 = new GeometryCurve(point3, point4); - geometry.Curves.Add(curve3); - outerLoop.CurveList.Add(curve3); - var curve4 = new GeometryCurve(point4, point1); - geometry.Curves.Add(curve4); - outerLoop.CurveList.Add(curve4); - geometry.Loops.Add(outerLoop); - var surface1 = new GeometrySurface(outerLoop); - geometry.Surfaces.Add(surface1); - layer.GeometrySurface = surface1; - layer.GeometrySurface.OuterLoop = outerLoop; layer.WaterpressureInterpolationModel = WaterpressureInterpolationModel.Hydrostatic; - layer.IsAquifer = true; soilProfile2D.Surfaces.Add(layer); - - layer = new SoilLayer2D - { - Name = "Layer 2" - }; + + layer = FactoryForSoilProfiles.CreateRectangularSoilLayer2D(-5, -10, 0, 100, null, soilProfile2D, true); + layer.Name = "Layer 2"; layer.Soil = soiList != null ? soiList.GetSoilByName("LM") : new Soil("LM", 18, 17); layer.Soil.ShearStrengthModel = ShearStrengthModel.CPhi; - outerLoop = new GeometryLoop(); - var point5 = new Point2D(0, -10); - geometry.Points.Add(point5); - var point6 = new Point2D(100, -10); - geometry.Points.Add(point6); - var curve5 = new GeometryCurve(point3, point6); - geometry.Curves.Add(curve5); - var curve6 = new GeometryCurve(point6, point5); - geometry.Curves.Add(curve6); - var curve7 = new GeometryCurve(point5, point4); - geometry.Curves.Add(curve7); - outerLoop.CurveList.Add(curve3); - outerLoop.CurveList.Add(curve5); - outerLoop.CurveList.Add(curve6); - outerLoop.CurveList.Add(curve7); - geometry.Loops.Add(outerLoop); - var surface2 = new GeometrySurface(outerLoop); - geometry.Surfaces.Add(surface2); - layer.GeometrySurface = surface2; - layer.GeometrySurface.OuterLoop = outerLoop; layer.WaterpressureInterpolationModel = WaterpressureInterpolationModel.Hydrostatic; - layer.IsAquifer = true; - soilProfile2D.Geometry = geometry; soilProfile2D.Surfaces.Add(layer); + + layer = FactoryForSoilProfiles.CreateRectangularSoilLayer2D(-10, -15, 0, 100, null, soilProfile2D, false); + soilProfile2D.Surfaces.Add(layer); return soilProfile2D; } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/SoilProfileValidator.cs =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/SoilProfileValidator.cs (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/SoilProfileValidator.cs (revision 5404) @@ -0,0 +1,186 @@ +// Copyright (C) Stichting Deltares 2024. All rights reserved. +// +// This file is part of the Dam Engine. +// +// The Dam Engine is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero 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.Linq; +using Deltares.DamEngine.Calculators.KernelWrappers.Common; +using Deltares.DamEngine.Calculators.Properties; +using Deltares.DamEngine.Data.General; +using Deltares.DamEngine.Data.Geometry; +using Deltares.DamEngine.Data.Geotechnics; + +namespace Deltares.DamEngine.Calculators.PlLinesCreator; + +/// +/// Soil profile validator (for 1D and 2D soil profile) for the creation of the piezometric level lines. +/// +public class SoilProfileValidator +{ + private enum LayerType + { + Aquifer, + Aquitard + } + + public SoilProfileType SoilProfileType { get; init; } + public SoilProfile1D SoilProfile1D { get; init; } + public SoilProfile2D SoilProfile2D { get; init; } + public string SoilGeometry2DName { get; init; } + public Soil DikeEmbankmentMaterial { get; init; } + public SurfaceLine2 SurfaceLine { get; init; } + + public void ValidateSoilProfileForPlLinesCreator() + { + ThrowIfInvalidSurfaceLine(); + ThrowIfRequiredCharacteristicPointsAreMissing(); + ThrowIfInsufficientSoilGeometryData(); + ThrowsIfNoLayerWithType(LayerType.Aquifer); + ThrowsIfNoLayerWithType(LayerType.Aquitard); + ThrowIfNoBottomAquifer(); + } + + /// + /// Check if the lowest layer is a continuous aquifer. + /// + /// + private void ThrowIfNoBottomAquifer() + { + bool isNoBottomAquifer; + if (SoilProfileType == SoilProfileType.ProfileType1D) + { + SoilProfile1D actualSoilProfile = GetRelevantSoilProfileForAquiferLayersSearch(); + SoilLayer1D relevantAquiferLayer = actualSoilProfile.BottomAquiferLayer; + isNoBottomAquifer = relevantAquiferLayer == null; + } + else + { + SoilProfile2DHelper.DetermineAquiferLayerBoundaryPoints(SoilProfile2DHelper.LayerType.BottomAquiferCluster, SoilProfile2D, + out Point2D[] _, + out Point2D[] bottomAquiferTopCoordinates); + isNoBottomAquifer = (bottomAquiferTopCoordinates == null); + } + + if (isNoBottomAquifer) + { + throw new PlLinesCreatorException(Resources.SoilProfileValidator_General + + string.Format(Resources.SoilProfileValidator_NoBottomAquiferLayer, SoilProfile2D.Name)); + } + } + + /// + /// Check if at least one layer with the given type is present in the soil profile. + /// + /// The type of layer: aquifer or aquitard. + /// + private void ThrowsIfNoLayerWithType(LayerType layerType) + { + bool isNoLayerWithGivenType; + if (SoilProfileType == SoilProfileType.ProfileType1D) + { + SoilProfile1D actualSoilProfile = GetRelevantSoilProfileForAquiferLayersSearch(); + IList aquiferLayers = actualSoilProfile.GetAquiferLayers(); + isNoLayerWithGivenType = layerType == LayerType.Aquifer ? aquiferLayers.Count == 0 : actualSoilProfile.Layers.Count - aquiferLayers.Count == 0; + } + else + { + IList aquiferLayers = SoilProfile2D.Surfaces.Where(s => s.IsAquifer).ToList(); + isNoLayerWithGivenType = layerType == LayerType.Aquifer ? aquiferLayers.Count == 0 : SoilProfile2D.Surfaces.Count - aquiferLayers.Count == 0; + } + + if (isNoLayerWithGivenType) + { + string message = layerType == LayerType.Aquifer ? Resources.SoilProfileValidator_NoAquifer : Resources.SoilProfileValidator_NoAquitard; + throw new PlLinesCreatorException(Resources.SoilProfileValidator_General + message); + } + } + + /// + /// Check if enough soil geometry data available. + /// + private void ThrowIfInsufficientSoilGeometryData() + { + bool hasNoGeometry1DData = (SoilProfileType == SoilProfileType.ProfileType1D) && SoilProfile1D == null; + bool hasNoGeometry2DData = ((SoilProfileType == SoilProfileType.ProfileTypeStiFile) && (SoilGeometry2DName == null || DikeEmbankmentMaterial == null)) || + ((SoilProfileType == SoilProfileType.ProfileType2D) && (SoilProfile2D == null || DikeEmbankmentMaterial == null)); + if (hasNoGeometry1DData || hasNoGeometry2DData) + { + throw new PlLinesCreatorException(Resources.SoilProfileValidator_General + + Resources.SoilProfileValidator_InsufficientSoilGeometryData); + } + } + + /// + /// Check if all the required characteristic points exist. + /// + private void ThrowIfRequiredCharacteristicPointsAreMissing() + { + if (!SurfaceLine.HasAnnotation(CharacteristicPointType.DikeTopAtRiver) || + !SurfaceLine.HasAnnotation(CharacteristicPointType.DikeTopAtPolder) || + !SurfaceLine.HasAnnotation(CharacteristicPointType.DikeToeAtPolder)) + { + throw new PlLinesCreatorException(Resources.SoilProfileValidator_General + + Resources.SoilProfileValidator_RequiredCharacteristicPointsMissing); + } + } + + /// + /// Check if a correct surface line has been imported. + /// + private void ThrowIfInvalidSurfaceLine() + { + if (SurfaceLine == null) + { + throw new PlLinesCreatorException(Resources.SoilProfileValidator_General + + Resources.SoilProfileValidator_NoSurfaceLineDefined); + } + + if (SurfaceLine.Geometry.Points.Count < 2) + { + throw new PlLinesCreatorException(Resources.SoilProfileValidator_General + + Resources.SoilProfileValidator_AtLeastTwoSurfaceLinePoints); + } + } + + private SoilProfile1D GetSoilProfileBelowPoint(double xCoordinate) + { + SoilProfile1D soilProfile1D; + switch (SoilProfileType) + { + case SoilProfileType.ProfileType1D: + soilProfile1D = SoilProfileHelper.DetermineForSurfaceLineCorrected1DProfileAtX(SoilProfile1D, SurfaceLine, xCoordinate, DikeEmbankmentMaterial); + return soilProfile1D; + case SoilProfileType.ProfileType2D: + soilProfile1D = SoilProfile2D.GetSoilProfile1D(xCoordinate); + return soilProfile1D; + case SoilProfileType.ProfileTypeStiFile: + throw new NotImplementedException(@"Using full 2D geometry (based on stix file) not yet available."); + default: + return null; + } + } + + private SoilProfile1D GetRelevantSoilProfileForAquiferLayersSearch() + { + GeometryPoint relevantPoint = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + return GetSoilProfileBelowPoint(relevantPoint.X); + } +} \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs =================================================================== diff -u -r5393 -r5404 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs (.../PlLinesToWaternetConverter.cs) (revision 5393) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs (.../PlLinesToWaternetConverter.cs) (revision 5404) @@ -63,18 +63,13 @@ public static Waternet CreateWaternetBasedOnPlLines(PlLines plLines, SoilProfile1D soilProfile1D, SurfaceLine2 surfaceLine, double penetrationLength, IntrusionVerticalWaterPressureType? pressureType) { + // The validation of the soil profile was already performed in the Pl-lines creator. + // Here we only have to check that the PL-lines were indeed created. ThrowWhenPlLinesIsNull(plLines); - ThrowWhenSoilProfileIsNull(soilProfile1D); - ThrowWhenSurfaceLineIsNull(surfaceLine); - + double xLeft = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelOutside).X; double xRight = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside).X; - if (soilProfile1D.BottomAquiferLayer == null) - { - throw new NoNullAllowedException(string.Format(Resources.NoBottomAquiferLayer, soilProfile1D.Name)); - } - var waternet = new Waternet(); PlLine plLine = plLines.Lines[PlLineType.Pl1]; @@ -134,15 +129,12 @@ /// is null. public static Waternet CreateWaternetBasedOnPlLines(PlLines plLines, SoilProfile2D soilProfile, double penetrationLength, IntrusionVerticalWaterPressureType? pressureType) { + // The validation of the soil profile was already performed in the Pl-lines creator. + // Here we only have to check that the PL-lines were indeed created. ThrowWhenPlLinesIsNull(plLines); - ThrowWhenSoilProfileIsNull(soilProfile); - + SoilProfile2DHelper.DetermineAquiferLayerBoundaryPoints(SoilProfile2DHelper.LayerType.BottomAquiferCluster, soilProfile, out Point2D[] bottomAquiferCoordinates, out _); - if (bottomAquiferCoordinates == null) - { - throw new NoNullAllowedException(string.Format(Resources.NoBottomAquiferLayer, soilProfile.Name)); - } - + var waternet = new Waternet(); PlLine plLine = plLines.Lines[PlLineType.Pl1]; if (plLine != null) @@ -486,19 +478,6 @@ } /// - /// Throws when the soil profile is not assigned. - /// - /// The soil profile. - /// - private static void ThrowWhenSoilProfileIsNull(SoilProfile soilProfile) - { - if (soilProfile == null) - { - throw new NoNullAllowedException(Resources.PlLinesToWaternetConverter_NoSoilProfileDefined); - } - } - - /// /// Throws when the pl lines object is not assigned. /// /// The pl lines. @@ -512,19 +491,6 @@ } /// - /// Throws when the surface line object is not assigned. - /// - /// The surface line. - /// - private static void ThrowWhenSurfaceLineIsNull(SurfaceLine2 surfaceLine) - { - if (surfaceLine == null) - { - throw new NoNullAllowedException(Resources.PlLinesToWaternetConverter_NoSurfaceLineDefined); - } - } - - /// /// Waternet lines can't coincide otherwise the program does not know which headline to use. /// That's why when the waternet line of the phreatic line coincides with the waternet line of either PL2, PL3 or PL4, /// an adjustment of the waternet line of the phreatic line is performed by moving it 1 mm upwards. Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs =================================================================== diff -u -r5033 -r5404 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5033) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5404) @@ -259,77 +259,95 @@ } /// - /// Looks up a localized string similar to The deepest layer is not an aquifer in soilprofile '{0}'.. + /// Looks up a localized string similar to No toe of dike has been defined in the surfaceline for location '{0}'.. /// - internal static string NoBottomAquiferLayer { + internal static string NoDikeToeDefinedForLocation { get { - return ResourceManager.GetString("NoBottomAquiferLayer", resourceCulture); + return ResourceManager.GetString("NoDikeToeDefinedForLocation", resourceCulture); } } /// - /// Looks up a localized string similar to No toe of dike has been defined in the surfaceline for location '{0}'.. + /// Looks up a localized string similar to Location '{0}', subsoil scenario '{1}', timestep '{2}', timestamp '{3}': The calculation failed with error message '{4}'.. /// - internal static string NoDikeToeDefinedForLocation { + internal static string OperationalCalculatorGeneralException { get { - return ResourceManager.GetString("NoDikeToeDefinedForLocation", resourceCulture); + return ResourceManager.GetString("OperationalCalculatorGeneralException", resourceCulture); } } /// - /// Looks up a localized string similar to No 1D soilprofile has been defined for location '{0}'.. + /// Looks up a localized string similar to Location '{0}', subsoil scenario '{1}', timestep '{2}', timestamp '{3}': The preparation for this calculation failed.. /// - internal static string NoSoilProfile1DDefinedForLocation { + internal static string OperationalCalculatorPrepareError { get { - return ResourceManager.GetString("NoSoilProfile1DDefinedForLocation", resourceCulture); + return ResourceManager.GetString("OperationalCalculatorPrepareError", resourceCulture); } } /// - /// Looks up a localized string similar to No surfaceline has been defined for location '{0}'.. + /// Looks up a localized string similar to Location '{0}', subsoil scenario '{1}', timestep '{2}', timestamp '{3}': The validation for this calculation failed.. /// - internal static string NoSurfaceLineDefinedForLocation { + internal static string OperationalCalculatorValidationFailed { get { - return ResourceManager.GetString("NoSurfaceLineDefinedForLocation", resourceCulture); + return ResourceManager.GetString("OperationalCalculatorValidationFailed", resourceCulture); } } - /// - /// Looks up a localized string similar to Location '{0}', subsoil scenario '{1}', timestep '{2}', timestamp '{3}': The calculation failed with error message '{4}'.. - /// - internal static string OperationalCalculatorGeneralException { + internal static string SoilProfileValidator_General { get { - return ResourceManager.GetString("OperationalCalculatorGeneralException", resourceCulture); + return ResourceManager.GetString("SoilProfileValidator_General", resourceCulture); } } /// - /// Looks up a localized string similar to Location '{0}', subsoil scenario '{1}', timestep '{2}', timestamp '{3}': The preparation for this calculation failed.. + /// Looks up a localized string similar to No surface line object defined. /// - internal static string OperationalCalculatorPrepareError { + internal static string SoilProfileValidator_NoSurfaceLineDefined { get { - return ResourceManager.GetString("OperationalCalculatorPrepareError", resourceCulture); + return ResourceManager.GetString("SoilProfileValidator_NoSurfaceLineDefined", resourceCulture); } } - /// - /// Looks up a localized string similar to Location '{0}', subsoil scenario '{1}', timestep '{2}', timestamp '{3}': The validation for this calculation failed.. - /// - internal static string OperationalCalculatorValidationFailed { + internal static string SoilProfileValidator_AtLeastTwoSurfaceLinePoints { get { - return ResourceManager.GetString("OperationalCalculatorValidationFailed", resourceCulture); + return ResourceManager.GetString("SoilProfileValidator_AtLeastTwoSurfaceLinePoints", resourceCulture); } } + internal static string SoilProfileValidator_RequiredCharacteristicPointsMissing { + get { + return ResourceManager.GetString("SoilProfileValidator_RequiredCharacteristicPointsMissing", resourceCulture); + } + } + + internal static string SoilProfileValidator_InsufficientSoilGeometryData { + get { + return ResourceManager.GetString("SoilProfileValidator_InsufficientSoilGeometryData", resourceCulture); + } + } + /// - /// Looks up a localized string similar to No surface line object defined. + /// Looks up a localized string similar to The deepest layer is not an aquifer in soilprofile '{0}'.. /// - internal static string PlLinesToWaternetConverter_NoSurfaceLineDefined { + internal static string SoilProfileValidator_NoBottomAquiferLayer { get { - return ResourceManager.GetString("PlLinesToWaternetConverter_NoSurfaceLineDefined", resourceCulture); + return ResourceManager.GetString("SoilProfileValidator_NoBottomAquiferLayer", resourceCulture); } } + internal static string SoilProfileValidator_NoAquifer { + get { + return ResourceManager.GetString("SoilProfileValidator_NoAquifer", resourceCulture); + } + } + + internal static string SoilProfileValidator_NoAquitard { + get { + return ResourceManager.GetString("SoilProfileValidator_NoAquitard", resourceCulture); + } + } + /// /// Looks up a localized string similar to No pl-lines object defined. ///