using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Deltares.DamEngine.Calculators.KernelWrappers.Common; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.General.PlLines; using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.TestHelpers; using NUnit.Framework; namespace Deltares.DamEngine.Calculators.Tests.KernelWrappers.Common { [TestFixture] public class PlLinesHelperTests { [Test] public void TestCreatePlLines() { // expected values retrieved from debugging Dam Classic (rev.663) // test CanCalculateThePipingFactorUsingSellmeijer4Forces var location = new Location(); location.SurfaceLine = FactoryForSurfaceLines.CreateSurfaceLineTutorial1(); var soilProfile1D = CreatePipingSellmeijerProfileWithOneSandlayer(); var riverLevel = 1.0; UpliftSituation upliftSituation; var plLines = PlLinesHelper.CreatePlLines(location, soilProfile1D, riverLevel, out upliftSituation); Assert.AreEqual(4, plLines.PLLineCount); Assert.AreEqual(8, plLines.Lines[PLLineType.PL1].Points.Count); Assert.IsTrue(new PLLinePoint(0.000, 1.000).LocationEquals(plLines.Lines[PLLineType.PL1].Points[0])); Assert.IsTrue(new PLLinePoint(14.900, 1.000).LocationEquals(plLines.Lines[PLLineType.PL1].Points[1])); Assert.IsTrue(new PLLinePoint(34.500, 0.500).LocationEquals(plLines.Lines[PLLineType.PL1].Points[2])); Assert.IsTrue(new PLLinePoint(40.500, 0.000).LocationEquals(plLines.Lines[PLLineType.PL1].Points[3])); Assert.IsTrue(new PLLinePoint(50.500, 0.000).LocationEquals(plLines.Lines[PLLineType.PL1].Points[4])); Assert.IsTrue(new PLLinePoint(58.500, 0.000).LocationEquals(plLines.Lines[PLLineType.PL1].Points[5])); Assert.IsTrue(new PLLinePoint(61.500, 0.000).LocationEquals(plLines.Lines[PLLineType.PL1].Points[6])); Assert.IsTrue(new PLLinePoint(75.000, 0.000).LocationEquals(plLines.Lines[PLLineType.PL1].Points[7])); Assert.AreEqual(0, plLines.Lines[PLLineType.PL2].Points.Count); Assert.AreEqual(2, plLines.Lines[PLLineType.PL3].Points.Count); Assert.IsTrue(new PLLinePoint(0.000, 1.000).LocationEquals(plLines.Lines[PLLineType.PL3].Points[0])); Assert.IsTrue(new PLLinePoint(75.000, 1.000).LocationEquals(plLines.Lines[PLLineType.PL3].Points[1])); Assert.AreEqual(0, plLines.Lines[PLLineType.PL4].Points.Count); } private static SoilProfile1D CreatePipingSellmeijerProfileWithOneSandlayer() { SoilProfile1D soilProfile1D = new SoilProfile1D(); SoilLayer1D soilLayer1D1 = new SoilLayer1D(); soilLayer1D1.Name = "L0"; soilLayer1D1.TopLevel = 10.0; soilLayer1D1.Soil = new Soil("Topmaterial", 1.0, 1.0); soilLayer1D1.Soil.PermeabKx = 0.0003; soilLayer1D1.Soil.DiameterD70 = 0.0003; soilLayer1D1.Soil.WhitesConstant = 0.5; soilLayer1D1.Soil.BeddingAngle = 57.0; soilLayer1D1.IsAquifer = false; soilProfile1D.Layers.Add(soilLayer1D1); SoilLayer1D soilLayer1D2 = new SoilLayer1D(); soilLayer1D2.Name = "L1"; soilLayer1D2.TopLevel = -2.0; soilLayer1D2.Soil = new Soil("Sand", 22.0, 20.0); soilLayer1D2.Soil.PermeabKx = 0.0001; soilLayer1D2.Soil.DiameterD70 = 0.0002; soilLayer1D2.Soil.WhitesConstant = 0.25; soilLayer1D2.Soil.BeddingAngle = 37.0; soilLayer1D2.IsAquifer = true; soilProfile1D.Layers.Add(soilLayer1D2); soilProfile1D.BottomLevel = -10.0; return soilProfile1D; } } }