// Copyright (C) Stichting Deltares 2019. 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 System.Text; using System.Threading.Tasks; using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.TestHelpers.Factories; using NUnit.Framework; namespace Deltares.DamEngine.Data.Tests.Geotechnics { [TestFixture] public class SoilSurfaceProfileTests { [Test] public void TestCreate2DProfileWithSimpleSurfaceLineAboveProfile() { // Create a 1D profiles with toplayer at -2 var prof1D = CreateTwoLayerProfile(-2); // surfaceLine has 7 points, varies in height from -1 to 5 m var surfaceLine = FactoryForSurfaceLines.CreateSimpleSurfaceLineForExitPointTest(); // Create profile var soilSurfaceProfile = new SoilSurfaceProfile { SoilProfile = prof1D, SurfaceLine2 = surfaceLine, DikeEmbankmentMaterial = new Soil { Name = "Dike material" } }; var profile2D = soilSurfaceProfile.ConvertToSoilProfile2D(); Assert.AreEqual(13, profile2D.Geometry.Points.Count); Assert.AreEqual(15, profile2D.Geometry.Curves.Count); Assert.AreEqual(3, profile2D.Surfaces.Count); } private static SoilProfile1D CreateTwoLayerProfile(double offset = 0) { var soilProfile = new SoilProfile1D(); var layer = new SoilLayer1D(); layer.TopLevel = 0.0 + offset; layer.Soil = new Soil("HW-OBO", 12.0, 10.0); layer.Soil.DryUnitWeight = 0.01; layer.IsAquifer = false; layer.WaterpressureInterpolationModel = WaterpressureInterpolationModel.Automatic; soilProfile.Layers.Add(layer); layer = new SoilLayer1D(); layer.TopLevel = -5.0 + offset; layer.Soil = new Soil("Alg-zand (0-30)", 22.0, 20.0); layer.Soil.DryUnitWeight = 0.01; layer.IsAquifer = true; layer.WaterpressureInterpolationModel = WaterpressureInterpolationModel.Hydrostatic; soilProfile.Layers.Add(layer); soilProfile.BottomLevel = -10.0 + offset; return soilProfile; } } }