Index: dam engine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile1DAquiferLayerCombiner.cs =================================================================== diff -u -r624 -r677 --- dam engine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile1DAquiferLayerCombiner.cs (.../SoilProfile1DAquiferLayerCombiner.cs) (revision 624) +++ dam engine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile1DAquiferLayerCombiner.cs (.../SoilProfile1DAquiferLayerCombiner.cs) (revision 677) @@ -1,4 +1,5 @@ using System; +using Deltares.DamEngine.Data.Properties; namespace Deltares.DamEngine.Data.Geotechnics { @@ -30,9 +31,9 @@ { if (interpolationModel != soilProfile1D.Layers[layerIndexAt].WaterpressureInterpolationModel) { - // ToDo move to resources - // throw new GeotechnicsUtilitiesException(string.Format(LocalizationManager.GetTranslatedText(this.GetType(), "InconsistentWaterpressureInterpolationModel"), (object)this.soilProfile1D.Name)); - throw new Exception("InconsistentWaterpressureInterpolationModel"); + throw new SoilProfile1DAquiferLayerCombinerException( + string.Format(Resources.SoilProfile1DAquiferLayerCombiner_CombineLayers_InconsistentWaterpressureInterpolationModel, + soilProfile1D.Name)); } double layerHeight = soilProfile1D.GetLayerHeight(soilProfile1D.Layers[layerIndexAt]); num1 += layerHeight; Index: dam engine/trunk/src/Deltares.DamEngine.Data/Properties/Resources.Designer.cs =================================================================== diff -u --- dam engine/trunk/src/Deltares.DamEngine.Data/Properties/Resources.Designer.cs (revision 0) +++ dam engine/trunk/src/Deltares.DamEngine.Data/Properties/Resources.Designer.cs (revision 677) @@ -0,0 +1,73 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Deltares.DamEngine.Data.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Deltares.DamEngine.Data.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to In combining the aquifer layer for 1D profile {0}, different water pressure interpolation models are used in the layers concerned which is not allowed.. + /// + internal static string SoilProfile1DAquiferLayerCombiner_CombineLayers_InconsistentWaterpressureInterpolationModel { + get { + return ResourceManager.GetString("SoilProfile1DAquiferLayerCombiner_CombineLayers_InconsistentWaterpressureInterpol" + + "ationModel", resourceCulture); + } + } + } +} Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/DamPipingHelper.cs =================================================================== diff -u -r624 -r677 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/DamPipingHelper.cs (.../DamPipingHelper.cs) (revision 624) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/DamPipingHelper.cs (.../DamPipingHelper.cs) (revision 677) @@ -51,10 +51,9 @@ /// public static double DetermineHeightCoverLayer(double topLevelAquifer, double surfaceLevel) { - topLevelAquifer = Math.Min(topLevelAquifer, surfaceLevel); var d = surfaceLevel - topLevelAquifer; - // if d negative is negative then top of aquifer is higher then surface layer. + // if d is negative then top of aquifer is higher than surface layer. // This means that the aquifer is exposed on the surface. // In this case d = 0 d = Math.Max(0, d); Index: dam engine/trunk/src/Deltares.DamEngine.Data/Deltares.DamEngine.Data.csproj =================================================================== diff -u -r669 -r677 --- dam engine/trunk/src/Deltares.DamEngine.Data/Deltares.DamEngine.Data.csproj (.../Deltares.DamEngine.Data.csproj) (revision 669) +++ dam engine/trunk/src/Deltares.DamEngine.Data/Deltares.DamEngine.Data.csproj (.../Deltares.DamEngine.Data.csproj) (revision 677) @@ -137,6 +137,7 @@ + @@ -148,6 +149,11 @@ + + True + True + Resources.resx + @@ -189,6 +195,14 @@ + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + "$(ProjectDir)..\..\utils\svn_insert_version.cmd" "$(ProjectDir)Properties" Index: dam engine/trunk/src/Deltares.DamEngine.Data/Properties/Resources.resx =================================================================== diff -u --- dam engine/trunk/src/Deltares.DamEngine.Data/Properties/Resources.resx (revision 0) +++ dam engine/trunk/src/Deltares.DamEngine.Data/Properties/Resources.resx (revision 677) @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + In combining the aquifer layer for 1D profile {0}, different water pressure interpolation models are used in the layers concerned which is not allowed. + + \ No newline at end of file Index: dam engine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilProfile1DAquiferLayerCombinerTests.cs =================================================================== diff -u -r643 -r677 --- dam engine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilProfile1DAquiferLayerCombinerTests.cs (.../SoilProfile1DAquiferLayerCombinerTests.cs) (revision 643) +++ dam engine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilProfile1DAquiferLayerCombinerTests.cs (.../SoilProfile1DAquiferLayerCombinerTests.cs) (revision 677) @@ -1,12 +1,106 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using Deltares.DamEngine.Data.Geometry; +using Deltares.DamEngine.Data.Geotechnics; +using NUnit.Framework; namespace Deltares.DamEngine.Data.Tests.Geotechnics { + [TestFixture] public class SoilProfile1DAquiferLayerCombinerTests { + + [Test] + public void TestResultsOfCombinedLayers() + { + const double diff = 0.0001; + var soilProfile1D = CreateProfile(); + var topLayerName = "L2"; + var aquiferLayer = SoilProfile1DAquiferLayerCombiner.CombineLayers(soilProfile1D, topLayerName); + // D70 from layer L2 + Assert.AreEqual(0.0002, aquiferLayer.D70, diff); + // Height from L2 + all layers below it that are aquifer unless an aquitard is in between + // so sum of L2 and L3: 3 + 2 = 5 + Assert.AreEqual(5.0, aquiferLayer.Height, diff); + // PermeabilityKx is average of L2 and L3 based on height + // (0.0001 * 3 + 0.0006 * 2) / (3 + 2) = 0.0003 + Assert.AreEqual(0.0003, aquiferLayer.PermeabilityKx, diff); + } + + [Test] + [ExpectedException(typeof(SoilProfile1DAquiferLayerCombinerException), + ExpectedMessage = + "Bij het samenstellen van de aquifer laag voor 1D profiel Test Profile hebben de samen te voegen lagen verschillende interpolatie methoden hetgeen niet is toegestaan." + )] + [SetUICulture("nl-NL")] + public void TestThrowsExceptionWhenInterpolationModelIsNotTheSameForAllCombinedLayers() + { + var soilProfile1D = CreateProfile(); + soilProfile1D.GetLayerWithName("L2").WaterpressureInterpolationModel = WaterpressureInterpolationModel.Automatic; + soilProfile1D.GetLayerWithName("L3").WaterpressureInterpolationModel = WaterpressureInterpolationModel.Hydrostatic; + soilProfile1D.Name = "Test Profile"; + var topLayerName = "L2"; + SoilProfile1DAquiferLayerCombiner.CombineLayers(soilProfile1D, topLayerName); + } + + private static SoilProfile1D CreateProfile() + { + SoilProfile1D soilProfile1D = new SoilProfile1D(); + soilProfile1D.BottomLevel = -12.0; + + SoilLayer1D soilLayer1 = new SoilLayer1D(); + soilLayer1.Name = "L0"; + soilLayer1.TopLevel = 13.0; + soilLayer1.Soil = new Soil("Sandy stuff", 22.0, 20.0); + soilLayer1.Soil.PermeabKx = 0.0004; + soilLayer1.Soil.DiameterD70 = 0.0005; + soilLayer1.IsAquifer = true; + soilProfile1D.Layers.Add(soilLayer1); + + SoilLayer1D soilLayer2 = new SoilLayer1D(); + soilLayer2.Name = "L1"; + soilLayer2.TopLevel = 10.0; + soilLayer2.Soil = new Soil("Topmaterial", 1.0, 1.0); + soilLayer2.Soil.PermeabKx = 0.0003; + soilLayer2.Soil.DiameterD70 = 0.0003; + soilLayer2.IsAquifer = false; + soilProfile1D.Layers.Add(soilLayer2); + + SoilLayer1D soilLayer3 = new SoilLayer1D(); + soilLayer3.Name = "L2"; + soilLayer3.TopLevel = -2.0; + soilLayer3.Soil = new Soil("Sand", 22.0, 20.0); + soilLayer3.Soil.PermeabKx = 0.0001; + soilLayer3.Soil.DiameterD70 = 0.0002; + soilLayer3.IsAquifer = true; + soilProfile1D.Layers.Add(soilLayer3); + + SoilLayer1D soilLayer4 = new SoilLayer1D(); + soilLayer4.Name = "L3"; + soilLayer4.TopLevel = -5.0; + soilLayer4.Soil = new Soil("Also sand", 22.0, 20.0); + soilLayer4.Soil.PermeabKx = 0.0006; + soilLayer4.Soil.DiameterD70 = 0.0006; + soilLayer4.IsAquifer = true; + soilProfile1D.Layers.Add(soilLayer4); + + SoilLayer1D soilLayer5 = new SoilLayer1D(); + soilLayer5.Name = "L4"; + soilLayer5.TopLevel = -7.0; + soilLayer5.Soil = new Soil("clay or so", 1.0, 1.0); + soilLayer5.Soil.PermeabKx = 0.0007; + soilLayer5.Soil.DiameterD70 = 0.0008; + soilLayer5.IsAquifer = false; + soilProfile1D.Layers.Add(soilLayer5); + + SoilLayer1D soilLayer6 = new SoilLayer1D(); + soilLayer6.Name = "L4"; + soilLayer6.TopLevel = -8.0; + soilLayer6.Soil = new Soil("More sand", 22.0, 20.0); + soilLayer6.Soil.PermeabKx = 0.0009; + soilLayer6.Soil.DiameterD70 = 0.0010; + soilLayer6.IsAquifer = true; + soilProfile1D.Layers.Add(soilLayer6); + + return soilProfile1D; + } } } Index: dam engine/trunk/src/Deltares.DamEngine.Data/Properties/Resources.nl-NL.resx =================================================================== diff -u --- dam engine/trunk/src/Deltares.DamEngine.Data/Properties/Resources.nl-NL.resx (revision 0) +++ dam engine/trunk/src/Deltares.DamEngine.Data/Properties/Resources.nl-NL.resx (revision 677) @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Bij het samenstellen van de aquifer laag voor 1D profiel {0} hebben de samen te voegen lagen verschillende interpolatie methoden hetgeen niet is toegestaan. + + \ No newline at end of file Index: dam engine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile1DAquiferLayerCombinerException.cs =================================================================== diff -u --- dam engine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile1DAquiferLayerCombinerException.cs (revision 0) +++ dam engine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile1DAquiferLayerCombinerException.cs (revision 677) @@ -0,0 +1,15 @@ +namespace Deltares.DamEngine.Data.Geotechnics +{ + /// + /// Exception combining aquifer layers in 1D soil profile + /// + /// + public class SoilProfile1DAquiferLayerCombinerException : System.Exception + { + /// + /// Initializes a new instance of the class. + /// + /// The message that describes the error. + public SoilProfile1DAquiferLayerCombinerException(string message) : base(message) { } + } +} Index: dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesKernelWrapperTests.cs =================================================================== diff -u -r672 -r677 --- dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesKernelWrapperTests.cs (.../DamPipingSellmeijer4ForcesKernelWrapperTests.cs) (revision 672) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesKernelWrapperTests.cs (.../DamPipingSellmeijer4ForcesKernelWrapperTests.cs) (revision 677) @@ -228,7 +228,7 @@ kernelWrapper.PostProcess(null, new DamPipingSellmeijer4ForcesOutput(), out result); } - public static SoilProfile1D CreatePipingSellmeijerProfileWithOneSandlayer() + private static SoilProfile1D CreatePipingSellmeijerProfileWithOneSandlayer() { SoilProfile1D soilProfile1D = new SoilProfile1D(); SoilLayer1D soilLayer1D1 = new SoilLayer1D(); @@ -256,7 +256,7 @@ return soilProfile1D; } - public static SurfaceLine2 CreateSurfaceLineTutorial1(bool includingTraffic = false) + private static SurfaceLine2 CreateSurfaceLineTutorial1(bool includingTraffic = false) { SurfaceLine2 surfaceLine2 = new SurfaceLine2(); surfaceLine2.Name = "Tutorial1"; Index: dam engine/trunk/src/Deltares.DamEngine.Data.Tests/Deltares.DamEngine.Data.Tests.csproj =================================================================== diff -u -r643 -r677 --- dam engine/trunk/src/Deltares.DamEngine.Data.Tests/Deltares.DamEngine.Data.Tests.csproj (.../Deltares.DamEngine.Data.Tests.csproj) (revision 643) +++ dam engine/trunk/src/Deltares.DamEngine.Data.Tests/Deltares.DamEngine.Data.Tests.csproj (.../Deltares.DamEngine.Data.Tests.csproj) (revision 677) @@ -31,6 +31,10 @@ MinimumRecommendedRules.ruleset + + False + ..\..\lib\NUnit\nunit.framework.dll + @@ -44,6 +48,12 @@ + + + {b7a49c1a-1c91-4d72-aba9-9fbac2509d8e} + Deltares.DamEngine.Data + +