Index: DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DamEngineIo/FillXmlInputFromDamUiTests.cs =================================================================== diff -u -r6758 -r6776 --- DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DamEngineIo/FillXmlInputFromDamUiTests.cs (.../FillXmlInputFromDamUiTests.cs) (revision 6758) +++ DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DamEngineIo/FillXmlInputFromDamUiTests.cs (.../FillXmlInputFromDamUiTests.cs) (revision 6776) @@ -73,7 +73,6 @@ // Load input file Input actualInput = DamXmlSerialization.LoadInputFromXmlFile(inputFilename); DamProjectData actualDamProjectData = FillDamUiFromXmlInput.CreateDamProjectData(actualInput); - CompareSoilLists(actualDamProjectData.WaterBoard.Dikes[0].SoilList, expectedDamProjectData.WaterBoard.Dikes[0].SoilList); CompareDamProjectData(actualDamProjectData, expectedDamProjectData); // The soil profiles 2D are not present in the expectedDamProjectData because they are created when calling // FillXmlInputFromDamUi.CreateInput. That's why they must be checked separately from the Input object. @@ -678,37 +677,6 @@ Assert.That(() => FillXmlInputFromDamUi.CreateInput(damProjectData), Throws.TypeOf(typeof(ArgumentNullException)).With.Message.EqualTo(expectedMessage)); } - /// Compares the soil lists. - /// The object comparer does not handle NaN's correctly, therefore this method is created. - /// The actual soil list. - /// The expected soil list. - private void CompareSoilLists(SoilList actualSoilList, SoilList expectedSoilList) - { - const string errorMessage = "Actual and expected values of {0} are not equal"; - foreach (Soil actualSoil in actualSoilList.Soils) - { - Soil expectedSoil = expectedSoilList.GetSoilByName(actualSoil.Name); - Assert.That(actualSoil.AbovePhreaticLevel, Is.EqualTo(expectedSoil.AbovePhreaticLevel), string.Format(errorMessage, "AbovePhreaticLevel")); - Assert.That(actualSoil.BelowPhreaticLevel, Is.EqualTo(expectedSoil.BelowPhreaticLevel), string.Format(errorMessage, "BelowPhreaticLevel")); - Assert.That(actualSoil.DryUnitWeight, Is.EqualTo(expectedSoil.DryUnitWeight), string.Format(errorMessage, "DryUnitWeight")); - Assert.That(actualSoil.BeddingAngle, Is.EqualTo(expectedSoil.BeddingAngle), string.Format(errorMessage, "BeddingAngle")); - Assert.That(actualSoil.DiameterD70, Is.EqualTo(expectedSoil.DiameterD70), string.Format(errorMessage, "DiameterD70")); - Assert.That(actualSoil.DiameterD90, Is.EqualTo(expectedSoil.DiameterD90), string.Format(errorMessage, "DiameterD90")); - Assert.That(actualSoil.PermeabKx, Is.EqualTo(expectedSoil.PermeabKx), string.Format(errorMessage, "PermeabKx")); - Assert.That(actualSoil.WhitesConstant, Is.EqualTo(expectedSoil.WhitesConstant), string.Format(errorMessage, "WhitesConstant")); - Assert.That(actualSoil.ShearStrengthModel, Is.EqualTo(expectedSoil.ShearStrengthModel), string.Format(errorMessage, "ShearStrengthModel")); - Assert.That(actualSoil.UseDefaultShearStrengthModel, Is.EqualTo(expectedSoil.UseDefaultShearStrengthModel), string.Format(errorMessage, "UseDefaultShearStrengthModel")); - Assert.That(actualSoil.Cohesion, Is.EqualTo(expectedSoil.Cohesion), string.Format(errorMessage, "Cohesion")); - Assert.That(actualSoil.FrictionAngle, Is.EqualTo(expectedSoil.FrictionAngle), string.Format(errorMessage, "FrictionAngle")); - Assert.That(actualSoil.OCR, Is.EqualTo(expectedSoil.OCR), string.Format(errorMessage, "OCR")); - Assert.That(actualSoil.RestSlope, Is.EqualTo(expectedSoil.RestSlope), string.Format(errorMessage, "RestSlope")); - Assert.That(actualSoil.DilatancyType, Is.EqualTo(expectedSoil.DilatancyType), string.Format(errorMessage, "DilatancyType")); - Assert.That(actualSoil.StrengthIncreaseExponent, Is.EqualTo(expectedSoil.StrengthIncreaseExponent), string.Format(errorMessage, "StrengthIncreaseExponent")); - Assert.That(actualSoil.RRatio, Is.EqualTo(expectedSoil.RRatio), string.Format(errorMessage, "RRatio")); - Assert.That(actualSoil.RatioCuPc, Is.EqualTo(expectedSoil.RatioCuPc), string.Format(errorMessage, "RatioCuPc")); - } - } - private static void CompareSoilProfiles2D(SoilProfile2D[] actual, SoilProfile2D[] expected) { var compare = new CompareLogic @@ -848,24 +816,10 @@ FillInputTimeSeries(damProjectData); FillSensorData(damProjectData); - FillTrafficLoadDegreeOfConsolidation(dike); return damProjectData; } + - private static void FillTrafficLoadDegreeOfConsolidation(Dike dike) - { - dike.TrafficLoadDegreeOfConsolidations = new List(); - for (var i = 0; i < dike.SoilList.Soils.Count; i++) - { - var loadDegreeOfConsolidation = new TrafficLoadDegreeOfConsolidation - { - DegreeOfConsolidation = i * 3, - SoilName = dike.SoilList.Soils[i].Name - }; - dike.TrafficLoadDegreeOfConsolidations.Add(loadDegreeOfConsolidation); - } - } - private void FillSensorData(DamProjectData damProjectData) { // Note: the properties SensorLocations, Sensors and SensorGroups of SensorData are automatically created @@ -1038,9 +992,10 @@ { const int soilCount = 3; dike.SoilList = new SoilList(); + dike.DamSoils = []; for (var i = 0; i < soilCount; i++) { - var soil = new Soil + var soil = new DamSoil { Name = $"Soil {i}" }; @@ -1057,11 +1012,12 @@ soil.StrengthIncreaseExponent = 28 + 0.1 * i; soil.RatioCuPc = 29 + 0.1 * i; - dike.SoilList.Add(soil); + dike.AddDamSoil(soil); + dike.DamSoils.Last().TrafficLoadDegreeOfConsolidation = 30 + 0.1 * i; } // Change 1 soil to ShearStrengthModel.StressTable (SigmaTauCurve) - Soil soilSigmaTauCurve = dike.SoilList.Soils[1]; + DamSoil soilSigmaTauCurve = dike.DamSoils[1]; soilSigmaTauCurve.ShearStrengthModel = ShearStrengthModel.StressTable; soilSigmaTauCurve.StressTable = new StressCurve(); soilSigmaTauCurve.StressTable.SigmaTaus.Add(new SigmaTau @@ -1076,7 +1032,7 @@ }); // Change 1 soil to ShearStrengthModel.SuTable - Soil soilSuTable = dike.SoilList.Soils[2]; + DamSoil soilSuTable = dike.DamSoils[2]; soilSuTable.ShearStrengthModel = ShearStrengthModel.SuTable; soilSuTable.SuTable = new SigmaSuCurve(); soilSuTable.SuTable.SigmaSus.Add(new SigmaSu @@ -1091,22 +1047,24 @@ }); // Add dike embankment material - var dikeSoil = new Soil + var dikeSoil = new DamSoil { Name = dikeEmbankmentMaterial, UseDefaultShearStrengthModel = false }; - dike.SoilList.Add(dikeSoil); + dike.AddDamSoil(dikeSoil); + dike.DamSoils.Last().TrafficLoadDegreeOfConsolidation = 31.1; // Add shoulder embankment materials for (var i = 0; i < locationCount; i++) { - var shoulderSoil = new Soil + var shoulderSoil = new DamSoil { Name = shoulderEmbankmentMaterial + (i + 1), UseDefaultShearStrengthModel = false }; - dike.SoilList.Add(shoulderSoil); + dike.AddDamSoil(shoulderSoil); + dike.DamSoils.Last().TrafficLoadDegreeOfConsolidation = 32.2; } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamSoil.cs =================================================================== diff -u --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamSoil.cs (revision 0) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamSoil.cs (revision 6776) @@ -0,0 +1,47 @@ +// Copyright (C) Stichting Deltares 2025. All rights reserved. +// +// This file is part of the application DAM - UI. +// +// DAM - UI 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 Deltares.Geotechnics.Soils; +using Deltares.Standard.Attributes; +using Deltares.Standard.Units; +using Deltares.Standard.Validation; + +namespace Deltares.Dam.Data; + +/// +/// Soil class containing the standard soil properties (DSL) extended with the degree of consolidation due to traffic load +/// +public sealed class DamSoil : Soil +{ + /// + /// Degree of consolidation due to traffic load [%]. + /// Note that it is a fraction: a degree of consolidation of 22% in the GUI has a value of 0.22 here. + /// Default is 100% (which means no effect of the traffic load on the pore pressures). + /// + //[Validate] + [PropertyOrder(10, 5)] + [Minimum(0)] + [Maximum(1)] + [Format("F0")] + [Unit(UnitType.Percentage)] + [UserColumnFilter(UserColumnFilters.MacrostabilityWti)] + public double TrafficLoadDegreeOfConsolidation { get; set; } = 1; +} \ No newline at end of file Index: DamClients/DamUI/trunk/src/Dam/Forms/DamPlugin.cs =================================================================== diff -u -r6769 -r6776 --- DamClients/DamUI/trunk/src/Dam/Forms/DamPlugin.cs (.../DamPlugin.cs) (revision 6769) +++ DamClients/DamUI/trunk/src/Dam/Forms/DamPlugin.cs (.../DamPlugin.cs) (revision 6776) @@ -447,8 +447,8 @@ { DynamicPropertyControl dpc = mainForm.DynamicPropertyControl; // deregister the ugly property control provided by the Geotechnics plugin - dpc.ClearRegistrationsForType(typeof(Soil)); - dpc.BuildDelayedPropertyControlForTypes(() => PropertyControlFactory.GetPropertyControl(), typeof(Soil)); + dpc.ClearRegistrationsForType(typeof(DamSoil)); + dpc.BuildDelayedPropertyControlForTypes(() => PropertyControlFactory.GetPropertyControl(), typeof(DamSoil)); dpc.BuildPropertyControlTabForTypes(locationPropertyControl, typeof(Location), typeof(LocationJob)); dpc.BuildPropertyControlTabForTypes(new LocationScenariosControl(), typeof(Location), typeof(LocationJob)); @@ -472,9 +472,9 @@ AllowUserColumnFilterEdit = true }; - mainForm.RegisterTableControl(typeof(Soil), materialsTable, "Materials"); - BindSupport.Bind(materialPanel, materialsTable, typeof(Dike), "SoilList.Soils"); - BindSupport.Bind(materialPanel, materialsTable.Parent, typeof(Dike), "SoilList.Soils", BindingType.Visibility); + mainForm.RegisterTableControl(typeof(DamSoil), materialsTable, "Materials"); + BindSupport.Bind(materialPanel, materialsTable, typeof(Dike), "DamSoils"); + BindSupport.Bind(materialPanel, materialsTable.Parent, typeof(Dike), "DamSoils", BindingType.Visibility); mainForm.DynamicTableControl.RegisterTable(typeof(Location), locationsControl, "Locations"); BindSupport.Bind(projectPanel, locationsControl, p => p.Locations); Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardImporter.cs =================================================================== diff -u -r6727 -r6776 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardImporter.cs (.../WaterBoardImporter.cs) (revision 6727) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardImporter.cs (.../WaterBoardImporter.cs) (revision 6776) @@ -199,10 +199,9 @@ foreach (string dikeRingId in dikeRingList) { // Add dikes to waterboard - List importedCsvSoils = importer.WaterBoard.Dikes.First(d => d.Name == dikeRingId).ImportedCsvSoils; + List importedCsvSoils = importer.WaterBoard.Dikes.First(d => d.Name == dikeRingId).ImportedCsvSoils; IEnumerable importedCsvAquifers = importer.WaterBoard.Dikes.First(d => d.Name == dikeRingId).Aquifers; - IEnumerable importedDegreeOfConsolidations = importer.WaterBoard.Dikes.First(d => d.Name == dikeRingId).TrafficLoadDegreeOfConsolidations; - Dike dike = ImportDataForDikeRing(importedCsvSoils, importedCsvAquifers, importedDegreeOfConsolidations, dikeRingId); + Dike dike = ImportDataForDikeRing(importedCsvSoils, importedCsvAquifers, dikeRingId); waterBoard.Dikes.Add(dike); } @@ -211,7 +210,7 @@ } /// - /// Validates the dike ring i ds. + /// Validates the dike ring ids. /// /// The dike ring ids. /// @@ -230,23 +229,24 @@ /// The dike. private void ImportSoils(string dikeRingID, Dike dike) { - dike.SoilList = GetSoils(dikeRingID); + List soils = GetSoils(dikeRingID); + foreach (DamSoil soil in soils) + { + dike.AddDamSoil(soil); + } } /// /// Gets the soils. /// /// The dike ring identifier. /// - private SoilList GetSoils(string dikeRingID) + private List GetSoils(string dikeRingID) { IEnumerable soilIdList = importer.GetSoilIdList(dikeRingID); - List soils = soilIdList.Select(soilID => ImportSoil(dikeRingID, soilID)).ToList(); + List soils = soilIdList.Select(soilId => ImportSoil(dikeRingID, soilId)).ToList(); - return new SoilList - { - Soils = soils - }; + return soils; } /// @@ -255,9 +255,9 @@ /// The dike ring identifier. /// The soil identifier. /// - private Soil ImportSoil(string dikeRingID, string soilID) + private DamSoil ImportSoil(string dikeRingID, string soilID) { - var soil = new Soil + var soil = new DamSoil { Name = soilID }; @@ -277,34 +277,28 @@ /// /// The soils as imported from the csv file /// The aquifers as imported from the csv file - /// The traffic load degree of consolidaiton as imported from the csv file /// The dike ring identifier. /// - private Dike ImportDataForDikeRing(List importedCsvSoils, IEnumerable importedCsvAquifers, IEnumerable importedDegreeOfConsolidations, string dikeRingId) + private Dike ImportDataForDikeRing(List importedCsvSoils, IEnumerable importedCsvAquifers, string dikeRingId) { var dike = new Dike { Name = dikeRingId }; ImportSoils(dikeRingId, dike); - + ImportSoilProfiles1D(dikeRingId, dike); ImportAquifers(importedCsvAquifers, dike); - ImportTrafficLoadDegreeOfConsolidation(importedDegreeOfConsolidations, dike); - ImportSegments(dikeRingId, dike); ImportSurfaceLines(dikeRingId, dike); ImportModelParameters(dikeRingId, dike); - // TODO: Import PL1-lines - ImportLocations(dikeRingId, dike); - //ImportScenarios(importer, dikeRingId, dike, waterBoard); ImportScenarios(dikeRingId, dike); // Use InvokeWithoutPublishingEvents for performance reasons after introducing SurfaceLine2 @@ -484,7 +478,7 @@ /// The dike. private void ImportSurfaceLines(string dikeRingId, Dike dike) { - // Use InvokeWithoutPublishingEvents for performance reasons after introducint SurfaceLine2 + // Use InvokeWithoutPublishingEvents for performance reasons after introducing SurfaceLine2 DataEventPublisher.InvokeWithoutPublishingEvents(() => { IEnumerable surfaceLineIdList = importer.GetSurfaceLineIdList(dikeRingId); @@ -635,14 +629,6 @@ } } - private static void ImportTrafficLoadDegreeOfConsolidation(IEnumerable trafficLoadDegreeOfConsolidations, Dike dike) - { - foreach (TrafficLoadDegreeOfConsolidation degreeOfConsolidation in trafficLoadDegreeOfConsolidations) - { - dike.TrafficLoadDegreeOfConsolidations.Add(degreeOfConsolidation); - } - } - /// /// Imports a profile. /// Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Translations.xml =================================================================== diff -u -r6750 -r6776 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Translations.xml (.../Translations.xml) (revision 6750) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Translations.xml (.../Translations.xml) (revision 6776) @@ -60,7 +60,8 @@ - + @@ -173,7 +174,7 @@ - + @@ -201,8 +202,8 @@ - - + + @@ -213,7 +214,8 @@ - + @@ -231,7 +233,8 @@ nl-NL="Aantal horizontale punten grid rechts (UV)"/> - + + nl-NL="Afstand tangent lijnen (UV)"/> @@ -261,7 +264,7 @@ - + - - + @@ -823,11 +826,11 @@ - + + nl-NL="Kan grondprofiel '{0}' niet importeren: {1}."/> @@ -837,10 +840,20 @@ - + + + + + + \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/DataPluginImporter.cs =================================================================== diff -u -r6713 -r6776 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/DataPluginImporter.cs (.../DataPluginImporter.cs) (revision 6713) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/DataPluginImporter.cs (.../DataPluginImporter.cs) (revision 6776) @@ -612,7 +612,7 @@ /// public IEnumerable GetSoilDetails(string dikeRingId, string soilId) { - Soil soil = GetSoil(dikeRingId, soilId); + DamSoil soil = GetSoil(dikeRingId, soilId); Dictionary nameValuePairs = SoilUtils.GetParametersAsNameValuePairs(soil); return GetParametersFromDictionary(nameValuePairs, soil); @@ -712,10 +712,10 @@ /// The dike ring identifier. /// The soil identifier. /// - private Soil GetSoil(string dikeRingId, string soilId) + private DamSoil GetSoil(string dikeRingId, string soilId) { Dike dike = GetDike(dikeRingId); - Soil soil = dike.SoilList.GetSoilByName(soilId); + DamSoil soil = dike.DamSoils.FirstOrDefault(s => s.Name.Equals(soilId, StringComparison.InvariantCultureIgnoreCase)); return soil; } Index: DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DikeTest.cs =================================================================== diff -u -r6436 -r6776 --- DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DikeTest.cs (.../DikeTest.cs) (revision 6436) +++ DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DikeTest.cs (.../DikeTest.cs) (revision 6776) @@ -63,13 +63,16 @@ { Name = "Segment1" }; - // this.dike.Segments.Add(this.segment1); // Locations location1 = new Location(); location1.Name = "Location1"; location1.Segment = segment1; dike.Locations.Add(location1); + + // Soil lists + dike.SoilList = new SoilList(); + dike.DamSoils = []; // Surface lines surfaceLine1 = new SurfaceLine2 @@ -131,9 +134,12 @@ // call using (var newDike = new Dike()) { - // assert - Assert.That(newDike.SurfaceLines2.Count, Is.EqualTo(0)); - Assert.That(newDike.Locations.Count, Is.EqualTo(0)); + Assert.Multiple(() => + { + // assert + Assert.That(newDike.SurfaceLines2, Is.Empty); + Assert.That(newDike.Locations, Is.Empty); + }); } } @@ -142,53 +148,62 @@ { Assert.That(dike, Is.Not.Null); - Assert.That(dike.Name, Is.EqualTo("Dike")); - //Assert.IsNotNull(this.dike.Segments); - Assert.That(dike.Locations, Is.Not.Null); - Assert.That(dike.SurfaceLines2, Is.Not.Null); - Assert.That(dike.SoilProfiles, Is.Not.Null); + Assert.Multiple(() => + { + Assert.That(dike.Name, Is.EqualTo("Dike")); + Assert.That(dike.Locations, Is.Not.Null); + Assert.That(dike.SurfaceLines2, Is.Not.Null); + Assert.That(dike.SoilProfiles, Is.Not.Null); + }); } -// [Test] -// public void TestDikeSegments() -// { -// Assert.IsNotNull(this.segment1); -// -// Assert.AreEqual(1, this.dike.Segments.Count); -// Assert.AreEqual(this.segment1, this.dike.Segments[0]); -// Assert.AreEqual("Segment1", this.segment1.Name); -// Assert.IsNotNull(this.segment1.GetMostProbableProfile(SegmentFailureMechanismType.Stability)); -// } - [Test] public void TestDikeLocations() { - Assert.That(location1, Is.Not.Null); + Assert.Multiple(() => + { + Assert.That(location1, Is.Not.Null); - Assert.That(dike.Locations.Count, Is.EqualTo(1)); - Assert.That(dike.Locations[0], Is.EqualTo(location1)); - Assert.That(location1.Name, Is.EqualTo("Location1")); + Assert.That(dike.Locations, Has.Count.EqualTo(1)); + }); + Assert.Multiple(() => + { + Assert.That(dike.Locations[0], Is.EqualTo(location1)); + Assert.That(location1.Name, Is.EqualTo("Location1")); + }); } [Test] public void TestDikeSurfaceLines() { Assert.That(surfaceLine1, Is.Not.Null); - Assert.That(surfaceLine1.Geometry.Points, Is.Not.Null); + Assert.Multiple(() => + { + Assert.That(surfaceLine1.Geometry.Points, Is.Not.Null); - Assert.That(dike.SurfaceLines2.Count, Is.EqualTo(1)); - Assert.That(dike.SurfaceLines2[0], Is.EqualTo(surfaceLine1)); - Assert.That(surfaceLine1.Name, Is.EqualTo("SurfaceLine1")); + Assert.That(dike.SurfaceLines2, Has.Count.EqualTo(1)); + }); + Assert.Multiple(() => + { + Assert.That(dike.SurfaceLines2[0], Is.EqualTo(surfaceLine1)); + Assert.That(surfaceLine1.Name, Is.EqualTo("SurfaceLine1")); + }); } [Test] public void TestDikeSoilProfiles() { - Assert.That(soilProfile, Is.Not.Null); + Assert.Multiple(() => + { + Assert.That(soilProfile, Is.Not.Null); - Assert.That(dike.SoilProfiles.Count, Is.EqualTo(1)); - Assert.That(dike.SoilProfiles[0], Is.EqualTo(soilProfile)); - Assert.That(soilProfile.Name, Is.EqualTo("SoilProfile1")); + Assert.That(dike.SoilProfiles, Has.Count.EqualTo(1)); + }); + Assert.Multiple(() => + { + Assert.That(dike.SoilProfiles[0], Is.EqualTo(soilProfile)); + Assert.That(soilProfile.Name, Is.EqualTo("SoilProfile1")); + }); } [Test] @@ -215,35 +230,39 @@ public void TestDikeSegmentsSurfaceLinePoints() { IList points = surfaceLine1.Geometry.Points; - Assert.That(points.Count, Is.EqualTo(6)); + Assert.That(points, Has.Count.EqualTo(6)); - Assert.That(points[0].X, Is.EqualTo(15.3)); - Assert.That(points[0].Z, Is.EqualTo(-3.52)); - Assert.That(points[1].X, Is.EqualTo(19.4)); - Assert.That(points[1].Z, Is.EqualTo(-1.46)); + Assert.Multiple(() => + { + Assert.That(points[0].X, Is.EqualTo(15.3)); + Assert.That(points[0].Z, Is.EqualTo(-3.52)); + Assert.That(points[1].X, Is.EqualTo(19.4)); + Assert.That(points[1].Z, Is.EqualTo(-1.46)); - Assert.That(surfaceLine1.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver), Is.EqualTo(points[1])); - Assert.That(surfaceLine1.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver), Is.EqualTo(points[2])); - Assert.That(surfaceLine1.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder), Is.EqualTo(points[3])); - Assert.That(surfaceLine1.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder), Is.EqualTo(points[4])); + Assert.That(surfaceLine1.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver), Is.EqualTo(points[1])); + Assert.That(surfaceLine1.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver), Is.EqualTo(points[2])); + Assert.That(surfaceLine1.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder), Is.EqualTo(points[3])); + Assert.That(surfaceLine1.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder), Is.EqualTo(points[4])); - Assert.That(surfaceLine1.GetCharacteristicPoints(points[0]).Count(cpt => cpt != CharacteristicPointType.None), Is.EqualTo(0)); - Assert.That(surfaceLine1.GetCharacteristicPoints(points[1]).First(), Is.EqualTo(CharacteristicPointType.DikeToeAtRiver)); + Assert.That(surfaceLine1.GetCharacteristicPoints(points[0]).Count(cpt => cpt != CharacteristicPointType.None), Is.EqualTo(0)); + Assert.That(surfaceLine1.GetCharacteristicPoints(points[1]).First(), Is.EqualTo(CharacteristicPointType.DikeToeAtRiver)); - Assert.That(surfaceLine1.HasDike(), Is.True); + Assert.That(surfaceLine1.HasDike(), Is.True); + }); } [Test] public void TestFillImportedCsvSoilsFromCsvFileWithoutSoilRecords_ThenNoDataBaseSoilsArePresent() { var newDike = new Dike(); newDike.FillImportedCsvSoilsFromCsvFile(new List()); - Assert.That(newDike.ImportedCsvSoils.Count, Is.Zero); + Assert.That(newDike.ImportedCsvSoils, Is.Empty); } [Test] public void TestFillImportedCsvSoilsFromCsvFileWithSoilRecords_ThenDataBaseSoilsAreFilled() { + const double percentageToFraction = 0.01; var newDike = new Dike(); var random = new Random(21); @@ -263,7 +282,8 @@ ShearStrengthModel = ShearStrengthModel.CPhi, StrengthIncreaseExponent = random.NextDouble(), RatioSuPc = random.NextDouble(), - Pop = random.NextDouble() + Pop = random.NextDouble(), + TrafficLoadDegreeOfConsolidation = random.NextDouble() }, new() { @@ -279,30 +299,82 @@ ShearStrengthModel = ShearStrengthModel.CuCalculated, StrengthIncreaseExponent = random.NextDouble(), RatioSuPc = random.NextDouble(), - Pop = random.NextDouble() + Pop = random.NextDouble(), + TrafficLoadDegreeOfConsolidation = random.NextDouble() } }; newDike.FillImportedCsvSoilsFromCsvFile(soilRecords); - Assert.That(newDike.ImportedCsvSoils.Count, Is.EqualTo(2)); + Assert.That(newDike.ImportedCsvSoils, Has.Count.EqualTo(2)); for (var i = 0; i < newDike.ImportedCsvSoils.Count; i++) { - Soil soil = newDike.ImportedCsvSoils[i]; + DamSoil soil = newDike.ImportedCsvSoils[i]; CsvImporterSoils.SoilRecord soilRecord = soilRecords[i]; - Assert.That(soil.Name, Is.EqualTo(soilRecord.SoilName)); - Assert.That(soil.Color, Is.EqualTo(soilRecord.SoilColor)); - Assert.That(soil.SoilType, Is.EqualTo(soilRecord.SoilType)); - Assert.That(soil.AbovePhreaticLevel, Is.EqualTo(soilRecord.UnsaturatedUnitWeight)); - Assert.That(soil.BelowPhreaticLevel, Is.EqualTo(soilRecord.SaturatedUnitWeight)); - Assert.That(soil.Cohesion, Is.EqualTo(soilRecord.Cohesion)); - Assert.That(soil.FrictionAngle, Is.EqualTo(soilRecord.FrictionAngle)); - Assert.That(soil.DiameterD70, Is.EqualTo(soilRecord.DiameterD70)); - Assert.That(soil.PermeabKx, Is.EqualTo(soilRecord.PermeabilityX)); - Assert.That(soil.ShearStrengthModel, Is.EqualTo(soilRecord.ShearStrengthModel)); - Assert.That(soil.StrengthIncreaseExponent, Is.EqualTo(soilRecord.StrengthIncreaseExponent)); - Assert.That(soil.RatioCuPc, Is.EqualTo(soilRecord.RatioSuPc)); - Assert.That(soil.POP, Is.EqualTo(soilRecord.Pop)); + Assert.Multiple(() => + { + Assert.That(soil.Name, Is.EqualTo(soilRecord.SoilName)); + Assert.That(soil.Color, Is.EqualTo(soilRecord.SoilColor)); + Assert.That(soil.SoilType, Is.EqualTo(soilRecord.SoilType)); + Assert.That(soil.AbovePhreaticLevel, Is.EqualTo(soilRecord.UnsaturatedUnitWeight)); + Assert.That(soil.BelowPhreaticLevel, Is.EqualTo(soilRecord.SaturatedUnitWeight)); + Assert.That(soil.Cohesion, Is.EqualTo(soilRecord.Cohesion)); + Assert.That(soil.FrictionAngle, Is.EqualTo(soilRecord.FrictionAngle)); + Assert.That(soil.DiameterD70, Is.EqualTo(soilRecord.DiameterD70)); + Assert.That(soil.PermeabKx, Is.EqualTo(soilRecord.PermeabilityX)); + Assert.That(soil.ShearStrengthModel, Is.EqualTo(soilRecord.ShearStrengthModel)); + Assert.That(soil.StrengthIncreaseExponent, Is.EqualTo(soilRecord.StrengthIncreaseExponent)); + Assert.That(soil.RatioCuPc, Is.EqualTo(soilRecord.RatioSuPc)); + Assert.That(soil.POP, Is.EqualTo(soilRecord.Pop)); + Assert.That(soil.TrafficLoadDegreeOfConsolidation, Is.EqualTo(soilRecord.TrafficLoadDegreeOfConsolidation * percentageToFraction)); + }); } } + + [Test] + public void GivenDamSoil_WhenAddingIt_ThenIsPresentInBothSoilLists() + { + var soil1 = new DamSoil(); + var soil2 = new DamSoil(); + + dike.AddDamSoil(soil1); + dike.AddDamSoil(soil2); + + Assert.Multiple(() => + { + Assert.That(dike.SoilList.Soils, Has.Count.EqualTo(2)); + Assert.That(dike.DamSoils, Has.Count.EqualTo(2)); + }); + Assert.Multiple(() => + { + Assert.That(dike.SoilList.Soils[0], Is.EqualTo(soil1)); + Assert.That(dike.SoilList.Soils[1], Is.EqualTo(soil2)); + Assert.That(dike.DamSoils[0], Is.EqualTo(soil1)); + Assert.That(dike.DamSoils[1], Is.EqualTo(soil2)); + }); + } + + [Test] + public void GivenDamSoil_WhenRemovingIt_ThenIsRemovedFromBothSoilLists() + { + var soil1 = new DamSoil(); + var soil2 = new DamSoil(); + dike.SoilList.Clear(); + dike.DamSoils.Clear(); + dike.AddDamSoil(soil1); + dike.AddDamSoil(soil2); + + dike.RemoveDamSoil(soil2); + + Assert.Multiple(() => + { + Assert.That(dike.SoilList.Soils, Has.Count.EqualTo(1)); + Assert.That(dike.DamSoils, Has.Count.EqualTo(1)); + }); + Assert.Multiple(() => + { + Assert.That(dike.SoilList.Soils[0], Is.EqualTo(soil1)); + Assert.That(dike.DamSoils[0], Is.EqualTo(soil1)); + }); + } } \ No newline at end of file Index: DamClients/DamUI/trunk/src/Dam/Forms/DamContext.cs =================================================================== diff -u -r6718 -r6776 --- DamClients/DamUI/trunk/src/Dam/Forms/DamContext.cs (.../DamContext.cs) (revision 6718) +++ DamClients/DamUI/trunk/src/Dam/Forms/DamContext.cs (.../DamContext.cs) (revision 6776) @@ -56,7 +56,7 @@ /// the flag public override bool? ShouldValidate(object source, string member) { - if (source is Soil soil) + if (source is DamSoil soil) { return ShouldValidateSoil(member, soil); } @@ -98,7 +98,7 @@ return true; } - var soil = source as Soil; + var soil = source as DamSoil; if (soil != null) { bool? visibleAccordingSoilUserFilter = VisibleAccordingSoilUserFilter(member); @@ -182,24 +182,24 @@ return true; } - if (source is Soil soil) + if (source is DamSoil soil) { - if (member == StaticReflection.GetMemberName(s => s.Name) || - member == StaticReflection.GetMemberName(s => s.StressTable) || - member == StaticReflection.GetMemberName(s => s.SuTable)) + if (member == StaticReflection.GetMemberName(s => s.Name) || + member == StaticReflection.GetMemberName(s => s.StressTable) || + member == StaticReflection.GetMemberName(s => s.SuTable)) { return false; } - if (member == StaticReflection.GetMemberName(s => s.POP) || - member == StaticReflection.GetMemberName(s => s.RatioCuPc) || - member == StaticReflection.GetMemberName(s => s.StrengthIncreaseExponent)) + if (member == StaticReflection.GetMemberName(s => s.POP) || + member == StaticReflection.GetMemberName(s => s.RatioCuPc) || + member == StaticReflection.GetMemberName(s => s.StrengthIncreaseExponent)) { return soil.ShearStrengthModel == ShearStrengthModel.CuCalculated; } - if (member == StaticReflection.GetMemberName(s => s.Cohesion) || - member == StaticReflection.GetMemberName(s => s.FrictionAngle)) + if (member == StaticReflection.GetMemberName(s => s.Cohesion) || + member == StaticReflection.GetMemberName(s => s.FrictionAngle)) { return soil.ShearStrengthModel == ShearStrengthModel.CPhi; } @@ -265,7 +265,7 @@ public override ICollection GetDomain(object source, string member) { - if (source is Soil && member == StaticReflection.GetMemberName(s => s.ShearStrengthModel)) + if (source is DamSoil && member == StaticReflection.GetMemberName(s => s.ShearStrengthModel)) { return new List { @@ -281,25 +281,25 @@ public override string GetFormat(Type type, object source, string member) { - if ((type == typeof(Soil) || source is Soil) && (member == StaticReflection.GetMemberName(x => x.PermeabKx))) + if ((type == typeof(DamSoil) || source is DamSoil) && (member == StaticReflection.GetMemberName(x => x.PermeabKx))) { return "E3"; } return base.GetFormat(type, source, member); } - private static bool ShouldValidateSoil(string member, Soil soil) + private static bool ShouldValidateSoil(string member, DamSoil soil) { - if (member == StaticReflection.GetMemberName(s => s.POP) || - member == StaticReflection.GetMemberName(s => s.RatioCuPc) || - member == StaticReflection.GetMemberName(s => s.StrengthIncreaseExponent)) + if (member == StaticReflection.GetMemberName(s => s.POP) || + member == StaticReflection.GetMemberName(s => s.RatioCuPc) || + member == StaticReflection.GetMemberName(s => s.StrengthIncreaseExponent)) { return soil.ShearStrengthModel == ShearStrengthModel.CuCalculated; } - if (member == StaticReflection.GetMemberName(s => s.Cohesion) || - member == StaticReflection.GetMemberName(s => s.FrictionAngle)) + if (member == StaticReflection.GetMemberName(s => s.Cohesion) || + member == StaticReflection.GetMemberName(s => s.FrictionAngle)) { return soil.ShearStrengthModel == ShearStrengthModel.CPhi; } @@ -348,31 +348,31 @@ private readonly HashSet alwaysVisibleProperties = new HashSet { - StaticReflection.GetMemberName(s => s.Name), - StaticReflection.GetMemberName(s => s.Color), - StaticReflection.GetMemberName(s => s.SoilType) + StaticReflection.GetMemberName(s => s.Name), + StaticReflection.GetMemberName(s => s.Color), + StaticReflection.GetMemberName(s => s.SoilType) }; private readonly HashSet macrostabilitySoilProperties = new HashSet { - StaticReflection.GetMemberName(s => s.AbovePhreaticLevel), - StaticReflection.GetMemberName(s => s.BelowPhreaticLevel), - StaticReflection.GetMemberName(s => s.ShearStrengthModel), - StaticReflection.GetMemberName(s => s.Cohesion), - StaticReflection.GetMemberName(s => s.FrictionAngle), - StaticReflection.GetMemberName(s => s.POP), - StaticReflection.GetMemberName(s => s.RatioCuPc), - StaticReflection.GetMemberName(s => s.StrengthIncreaseExponent), - StaticReflection.GetMemberName(s => s.StressTable), - StaticReflection.GetMemberName(s => s.SuTable) + StaticReflection.GetMemberName(s => s.AbovePhreaticLevel), + StaticReflection.GetMemberName(s => s.BelowPhreaticLevel), + StaticReflection.GetMemberName(s => s.ShearStrengthModel), + StaticReflection.GetMemberName(s => s.Cohesion), + StaticReflection.GetMemberName(s => s.FrictionAngle), + StaticReflection.GetMemberName(s => s.POP), + StaticReflection.GetMemberName(s => s.RatioCuPc), + StaticReflection.GetMemberName(s => s.StrengthIncreaseExponent), + StaticReflection.GetMemberName(s => s.StressTable), + StaticReflection.GetMemberName(s => s.TrafficLoadDegreeOfConsolidation) }; private readonly HashSet pipingSoilProperties = new HashSet { - StaticReflection.GetMemberName(s => s.AbovePhreaticLevel), - StaticReflection.GetMemberName(s => s.BelowPhreaticLevel), - StaticReflection.GetMemberName(s => s.DiameterD70), - StaticReflection.GetMemberName(s => s.PermeabKx) + StaticReflection.GetMemberName(s => s.AbovePhreaticLevel), + StaticReflection.GetMemberName(s => s.BelowPhreaticLevel), + StaticReflection.GetMemberName(s => s.DiameterD70), + StaticReflection.GetMemberName(s => s.PermeabKx) }; private HashSet combinedSoilProperties; Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/IO/CombineImportedData.cs =================================================================== diff -u -r6669 -r6776 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/IO/CombineImportedData.cs (.../CombineImportedData.cs) (revision 6669) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/IO/CombineImportedData.cs (.../CombineImportedData.cs) (revision 6776) @@ -425,8 +425,7 @@ private void TransferSoilData(Dike dike) { dike.FillImportedCsvSoilsFromCsvFile(SoilRecords); - dike.AssignImportedCsvSoilsPropertiesToSoilListSoils(); - dike.FillTrafficLoadDegreeOfConsolidationFromCsvFile(SoilRecords); + dike.AssignImportedCsvSoilsPropertiesToBothSoilLists(); } private void TransferSigmaTauCurveData(Dike dike) @@ -529,11 +528,11 @@ int soilIndex = dike.SoilList.GetSoilIndexByName(soilProfileRecord.SoilName); if (soilIndex == -1) { - var soil = new Soil + var soil = new DamSoil { Name = soilProfileRecord.SoilName }; - dike.SoilList.Soils.Add(soil); + dike.AddDamSoil(soil); soilIndex = dike.SoilList.Soils.Count - 1; } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlInput.cs =================================================================== diff -u -r6741 -r6776 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlInput.cs (.../FillDamUiFromXmlInput.cs) (revision 6741) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlInput.cs (.../FillDamUiFromXmlInput.cs) (revision 6776) @@ -66,7 +66,7 @@ var localSurfaceLines = new List(); TransferSurfaceLines(input.SurfaceLines, localSurfaceLines); dike.SoilList = new SoilList(); - TransferSoils(input.Soils, dike.SoilList); + TransferSoils(input.Soils, dike); TransferSoilProfiles1D(input.SoilProfiles1D, dike.SoilProfiles, dike.SoilList); TransferSegments(input.Segments, dike.SoilProfiles, damProjectData.WaterBoard.Segments); TransferLocations(input.Locations, dike.Locations, localSurfaceLines, damProjectData.WaterBoard.Segments); @@ -128,7 +128,7 @@ }); } - // Transfer sensorgroups + // Transfer sensor groups foreach (SensorGroup inputSensorGroup in inputSensorData.SensorGroups) { var sensorGroup = new Group(); @@ -142,7 +142,7 @@ sensorData.SensorGroups.Add(sensorGroup); } - // Transfer sensorlocations + // Transfer sensor locations foreach (SensorLocation inputSensorLocation in inputSensorData.SensorLocations) { var sensorLocation = new Sensors.SensorLocation(); @@ -348,12 +348,11 @@ } } - private static void TransferSoils(Soil[] inputSoils, SoilList dikeSoilList) + private static void TransferSoils(Soil[] inputSoils, Dike dike) { - List soils = dikeSoilList.Soils; for (var i = 0; i < inputSoils.Length; i++) { - var soil = new Geotechnics.Soils.Soil(); + var soil = new DamSoil(); Soil inputSoil = inputSoils[i]; soil.Name = inputSoil.Name; soil.AbovePhreaticLevel = inputSoil.AbovePhreaticLevelSpecified ? inputSoil.AbovePhreaticLevel : double.NaN; @@ -396,7 +395,7 @@ soil.StrengthIncreaseExponent = inputSoil.StrengthIncreaseExponentSpecified ? inputSoil.StrengthIncreaseExponent : double.NaN; soil.RatioCuPc = inputSoil.RatioCuPcSpecified ? inputSoil.RatioCuPc : double.NaN; soil.POP = inputSoil.PopSpecified ? inputSoil.Pop : double.NaN; - soils.Add(soil); + dike.AddDamSoil(soil); } } @@ -573,17 +572,13 @@ private static void TransferTrafficLoadDegreeOfConsolidation(IList inputTrafficLoadDegreeOfConsolidations, Dike dike) { + const double percentageToFraction = 0.01; if (inputTrafficLoadDegreeOfConsolidations != null) { - dike.TrafficLoadDegreeOfConsolidations = new List(inputTrafficLoadDegreeOfConsolidations.Count); foreach (InputTrafficLoadDegreeOfConsolidation inputDegreeOfConsolidation in inputTrafficLoadDegreeOfConsolidations) { - var trafficLoadDegreeOfConsolidation = new TrafficLoadDegreeOfConsolidation - { - SoilName = inputDegreeOfConsolidation.SoilName, - DegreeOfConsolidation = inputDegreeOfConsolidation.DegreeOfConsolidation - }; - dike.TrafficLoadDegreeOfConsolidations.Add(trafficLoadDegreeOfConsolidation); + DamSoil soil = dike.DamSoils.First(s => s.Name == inputDegreeOfConsolidation.SoilName); + soil.TrafficLoadDegreeOfConsolidation = inputDegreeOfConsolidation.DegreeOfConsolidation * percentageToFraction; } } } Index: DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/IO/CombineImportedDataTest.cs =================================================================== diff -u -r6669 -r6776 --- DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/IO/CombineImportedDataTest.cs (.../CombineImportedDataTest.cs) (revision 6669) +++ DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/IO/CombineImportedDataTest.cs (.../CombineImportedDataTest.cs) (revision 6776) @@ -256,13 +256,13 @@ }); // Check degree of consolidation data - Assert.That(damProjectData.WaterBoard.Dikes[0].TrafficLoadDegreeOfConsolidations, Has.Count.EqualTo(51)); - TrafficLoadDegreeOfConsolidation degreeOfConsolidation = damProjectData.WaterBoard.Dikes[0].TrafficLoadDegreeOfConsolidations.FirstOrDefault(s => s.SoilName == "CCC"); + Assert.That(damProjectData.WaterBoard.Dikes[0].DamSoils, Has.Count.EqualTo(51)); + DamSoil degreeOfConsolidation = damProjectData.WaterBoard.Dikes[0].DamSoils.FirstOrDefault(s => s.Name == "CCC"); Assert.That(degreeOfConsolidation, Is.Not.Null); - Assert.That(degreeOfConsolidation.DegreeOfConsolidation, Is.EqualTo(25)); - degreeOfConsolidation = damProjectData.WaterBoard.Dikes[0].TrafficLoadDegreeOfConsolidations.FirstOrDefault(s => s.SoilName == "BAS"); + Assert.That(degreeOfConsolidation.TrafficLoadDegreeOfConsolidation, Is.EqualTo(25)); + degreeOfConsolidation = damProjectData.WaterBoard.Dikes[0].DamSoils.FirstOrDefault(s => s.Name == "BAS"); Assert.That(degreeOfConsolidation, Is.Not.Null); - Assert.That(degreeOfConsolidation.DegreeOfConsolidation, Is.EqualTo(100)); + Assert.That(degreeOfConsolidation.TrafficLoadDegreeOfConsolidation, Is.EqualTo(100)); // Check location specific data Location location = damProjectData.WaterBoard.Dikes[0].Locations.FirstOrDefault(s => s.Name.Equals("25-2-2-A-1-A")); Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Dike.cs =================================================================== diff -u -r6660 -r6776 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Dike.cs (.../Dike.cs) (revision 6660) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Dike.cs (.../Dike.cs) (revision 6776) @@ -38,8 +38,7 @@ public class DikeException : Exception { - public DikeException(string message) - : base(message) {} + public DikeException(string message) : base(message) {} } public class DikeParameterNames @@ -54,6 +53,7 @@ private IList pl1Lines; private SoilList soilList; + private List damSoils; private IList soilProfiles; public Dike() @@ -66,6 +66,7 @@ SurfaceLines2 = new List(); pl1Lines = new List(); soilList = new SoilList(); + damSoils = new List(); } public virtual string MapForSoilGeometries2D { get; set; } @@ -98,17 +99,21 @@ set => soilProfiles = value; } - [Validate] public virtual SoilList SoilList { get => soilList; set => soilList = value; } + [Validate] + public virtual List DamSoils + { + get => damSoils; + set => damSoils = value; + } + public virtual IList Aquifers { get; set; } = new List(); - public virtual IList TrafficLoadDegreeOfConsolidations { get; set; } = new List(); - [Browsable(false)] public virtual IList Gauges { get; set; } = new List(); [Browsable(false)] public virtual IList GaugePLLines { get; set; } = new List(); @@ -132,6 +137,16 @@ public string Description { get; set; } = ""; /// + /// Add the to both soil lists (SoilList and DamSoils). + /// + /// The soil to be added. + public void AddDamSoil(DamSoil damSoil) + { + damSoils.Add(damSoil); + soilList.Add(damSoil); + } + + /// /// Updates the locations for scenarios. /// public void UpdateLocationsForScenarios() @@ -180,14 +195,15 @@ /// public void FillImportedCsvSoilsFromCsvFile(IEnumerable soilRecords) { + const double percentageToFraction = 0.01; if (soilRecords == null) { return; } foreach (CsvImporterSoils.SoilRecord soilRecord in soilRecords) { - var soil = new Soil(); + var soil = new DamSoil(); soil.Name = soilRecord.SoilName; soil.Color = soilRecord.SoilColor; soil.SoilType = soilRecord.SoilType; @@ -262,36 +278,12 @@ soil.POP = soilRecord.Pop.Value; } - ImportedCsvSoils.Add(soil); - } - } - - /// - /// Add to traffic load degree of consolidation as read from the csv-file to the dike soils. - /// All the soils are added (not only the soils used by the soil profiles) because the Dike and Shoulder embankment materials - /// are not yet present in SoilList. In FillXmlInputFromDamUi.TransferTrafficLoadDegreeOfConsolidation, only the - /// soils actually used will be transferred. - /// - public void FillTrafficLoadDegreeOfConsolidationFromCsvFile(IEnumerable soilRecords) - { - if (soilRecords == null) - { - return; - } - - foreach (CsvImporterSoils.SoilRecord soilRecord in soilRecords) - { - var degreeOfConsolidation = new TrafficLoadDegreeOfConsolidation - { - SoilName = soilRecord.SoilName - }; - if (soilRecord.TrafficLoadDegreeOfConsolidation.HasValue) { - degreeOfConsolidation.DegreeOfConsolidation = soilRecord.TrafficLoadDegreeOfConsolidation.Value; + soil.TrafficLoadDegreeOfConsolidation = soilRecord.TrafficLoadDegreeOfConsolidation.Value * percentageToFraction; } - TrafficLoadDegreeOfConsolidations.Add(degreeOfConsolidation); + ImportedCsvSoils.Add(soil); } } @@ -386,11 +378,11 @@ /// Adapt data so it is consistent /// /// The soils as imported from the csv file - public IEnumerable MakeDataConsistent(List importedCsvSoils) + public IEnumerable MakeDataConsistent(List importedCsvSoils) { List soilErrorMessages; var logMessages = new List(); - List errorSoils = TryToMakeSoilDataConsistent(importedCsvSoils, out soilErrorMessages); + List errorSoils = TryToMakeSoilDataConsistent(importedCsvSoils, out soilErrorMessages); for (var i = 0; i < soilErrorMessages.Count; i++) { logMessages.Add(new LogMessage(LogMessageType.Warning, this, soilErrorMessages[i])); @@ -432,11 +424,11 @@ } /// - /// Transfer the properties of the imported soils to the existing soils in the soil list. + /// Transfer the properties of the imported soils to the existing soils in both soil lists (SoilList.Soils and DamSoils). /// - public void AssignImportedCsvSoilsPropertiesToSoilListSoils() + public void AssignImportedCsvSoilsPropertiesToBothSoilLists() { - foreach (Soil soil in ImportedCsvSoils) + foreach (DamSoil soil in ImportedCsvSoils) { Soil existingSoil = soilList.GetSoilByName(soil.Name); if (existingSoil != null) @@ -479,55 +471,67 @@ } } - internal List ImportedCsvSoils { get; } = new(); + internal List ImportedCsvSoils { get; } = new(); internal List ImportedCsvStressCurves { get; } = new(); internal List ImportedCsvSuTables { get; } = new(); /// - /// Tries to make the soil data as read for 1D profiles consistent with the data in the soil database. - /// In the end we have a neat soil list with parameters for every soil as read from the database. - /// We might have a list with errors (soils that were not to be found in the database so soils for which - /// no parameters could be found). + /// Remove the from both soil lists (SoilList and DamSoils). /// + /// The soil to be removed. + internal void RemoveDamSoil(DamSoil damSoil) + { + damSoils.Remove(damSoil); + soilList.Remove(damSoil); + } + + /// + /// Tries to make the soil data as read for 1D profiles consistent with the data in the soil database. + /// In the end we have a neat soil list with parameters for every soil as read from the database. + /// We might have a list with errors (soils that were not to be found in the database so soils for which + /// no parameters could be found). + /// /// The soils as imported from the csv file + /// The list with errors (soils that were not to be found in the soils.csv so soils for which + /// no parameters could be found). /// - private List TryToMakeSoilDataConsistent(List importedCsvSoils, out List soilErrorMessages) + private List TryToMakeSoilDataConsistent(List importedCsvSoils, out List soilErrorMessages) { soilErrorMessages = new List(); - var errorSoils = new List(); - // Fill the list of errorSoils with soils that are in the current soillist (as result of importing + var errorSoils = new List(); + // Fill the list of errorSoils with soils that are in the current soil list (as result of importing // 1D profiles) but that are not found in the soil database because there are errors - foreach (Soil soil in soilList.Soils) + foreach (DamSoil soil in damSoils) { - Soil fs = importedCsvSoils.Find(t => string.Equals(t.Name, soil.Name, StringComparison.CurrentCultureIgnoreCase)); + DamSoil fs = importedCsvSoils.Find(t => string.Equals(t.Name, soil.Name, StringComparison.CurrentCultureIgnoreCase)); if (fs == null) { errorSoils.Add(soil); soilErrorMessages.Add(string.Format(LocalizationManager.GetTranslatedText(GetType(), "SoilNotFoundInCsvFile"), soil.Name)); } } - // Remove the error soils form the list - foreach (Soil errorSoil in errorSoils) + // Remove the error soils from the list + foreach (DamSoil errorSoil in errorSoils) { - soilList.Soils.Remove(errorSoil); + RemoveDamSoil(errorSoil); } // Get the parameters for every soil in the now proper soil list from the database. Add soils // that are in the database but not yet in the soil list. - foreach (Soil soil in importedCsvSoils) + foreach (DamSoil soil in importedCsvSoils) { if ((soil.StressTable.SigmaTaus.Count == 0) && (soil.StressTable.Name != "")) { - soilList.Soils.Remove(soil); + RemoveDamSoil(soil); errorSoils.Add(soil); soilErrorMessages.Add(string.Format(LocalizationManager.GetTranslatedText(GetType(), "SigmaTauCurveNotFoundInCsvFile"), soil.StressTable.Name, soil.Name)); } if ((soil.SuTable.SigmaSus.Count == 0) && (soil.SuTable.Name != "")) { - soilList.Soils.Remove(soil); + RemoveDamSoil(soil); errorSoils.Add(soil); soilErrorMessages.Add(string.Format(LocalizationManager.GetTranslatedText(GetType(), "SuTableNotFoundInCsvFile"), soil.SuTable.Name, soil.Name)); @@ -536,7 +540,7 @@ Soil existingSoil = soilList.GetSoilByName(soil.Name); if (existingSoil == null) { - soilList.Soils.Add(soil); + AddDamSoil(soil); } else { @@ -550,7 +554,7 @@ /// /// Removes all locations which have profiles that have invalid soils /// - private List DeleteLocationsWithProfilesWithUnknownSoils(List invalidSoils) + private List DeleteLocationsWithProfilesWithUnknownSoils(List invalidSoils) { var logMessages = new List(); var invalidLocations = new List(); @@ -598,13 +602,13 @@ /// /// /// - private bool DoesLocationHaveInvalidSoils(List invalidSoils, Location location, out string soilProf, out string invSoil) + private bool DoesLocationHaveInvalidSoils(List invalidSoils, Location location, out string soilProf, out string invSoil) { soilProf = " "; invSoil = " "; foreach (SoilGeometryProbability spp in location.Segment.SoilProfileProbabilities) { - foreach (Soil invalidSoil in invalidSoils) + foreach (DamSoil invalidSoil in invalidSoils) { if (spp.SoilProfile != null) { Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillXmlInputFromDamUi.cs =================================================================== diff -u -r6741 -r6776 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillXmlInputFromDamUi.cs (.../FillXmlInputFromDamUi.cs) (revision 6741) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillXmlInputFromDamUi.cs (.../FillXmlInputFromDamUi.cs) (revision 6776) @@ -111,7 +111,7 @@ input.Soils = new DamEngine.Io.XmlInput.Soil[usedSoils.Count]; TransferSoils(usedSoils, input.Soils); - TransferTrafficLoadDegreeOfConsolidation(dike.TrafficLoadDegreeOfConsolidations, usedSoils, input); + TransferTrafficLoadDegreeOfConsolidation(dike.DamSoils, usedSoils, input); if (damProjectData.InputTimeSerieCollection != null) { @@ -190,13 +190,13 @@ foreach (Location location in locations) { // Add the soil materials used as dike embankment material in Locations - if (!(location.DikeEmbankmentMaterial == null || !location.DikeEmbankmentMaterial.Any()) && - !usedSoils.Any(usedSoil => string.Equals(usedSoil.Name, location.DikeEmbankmentMaterial, - StringComparison.OrdinalIgnoreCase))) + if (!(location.DikeEmbankmentMaterial == null || !location.DikeEmbankmentMaterial.Any()) && + !usedSoils.Any(usedSoil => string.Equals(usedSoil.Name, location.DikeEmbankmentMaterial, + StringComparison.OrdinalIgnoreCase))) { try { - usedSoils.Add(allSoils.First(soil => string.Equals(soil.Name, location.DikeEmbankmentMaterial, + usedSoils.Add(allSoils.First(soil => string.Equals(soil.Name, location.DikeEmbankmentMaterial, StringComparison.OrdinalIgnoreCase))); } catch (Exception e) @@ -207,13 +207,13 @@ } // Add the soil materials used as shoulder embankment material in Locations - if (!(location.ShoulderEmbankmentMaterial == null || !location.ShoulderEmbankmentMaterial.Any()) && - !usedSoils.Any(usedSoil => string.Equals(usedSoil.Name, location.ShoulderEmbankmentMaterial, - StringComparison.OrdinalIgnoreCase))) + if (!(location.ShoulderEmbankmentMaterial == null || !location.ShoulderEmbankmentMaterial.Any()) && + !usedSoils.Any(usedSoil => string.Equals(usedSoil.Name, location.ShoulderEmbankmentMaterial, + StringComparison.OrdinalIgnoreCase))) { try { - usedSoils.Add(allSoils.First(soil => string.Equals(soil.Name, location.ShoulderEmbankmentMaterial, + usedSoils.Add(allSoils.First(soil => string.Equals(soil.Name, location.ShoulderEmbankmentMaterial, StringComparison.OrdinalIgnoreCase))); } catch (Exception e) @@ -401,7 +401,7 @@ { input.StabilityParameters = new StabilityParameters(); input.StabilityParameters.SearchMethod = ConversionHelper.ConvertToInputSearchMethod(curSpec.FailureMechanismeParamatersMStab.MStabParameters.SearchMethod); - input.StabilityParameters.IsUpliftVanRunOnlyWhenUpliftOccurs = + input.StabilityParameters.IsUpliftVanRunOnlyWhenUpliftOccurs = curSpec.FailureMechanismeParamatersMStab.MStabParameters.IsUpliftVanRunOnlyWhenUpliftOccurs; SlipCircleDefinition slipCircleDefinition = curSpec.FailureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition; if (slipCircleDefinition != null) @@ -772,21 +772,22 @@ } } - private static void TransferTrafficLoadDegreeOfConsolidation(IList trafficLoadDegreeOfConsolidations, List usedSoils, Input input) + private static void TransferTrafficLoadDegreeOfConsolidation(List trafficLoadDegreeOfConsolidations, List usedSoils, Input input) { + const double fractionToPercentage = 100; InputTrafficLoadDegreeOfConsolidation[] inputTrafficLoadDegreeOfConsolidations; if (trafficLoadDegreeOfConsolidations != null && trafficLoadDegreeOfConsolidations.Count > 0) { inputTrafficLoadDegreeOfConsolidations = new InputTrafficLoadDegreeOfConsolidation[usedSoils.Count]; var index = 0; - foreach (TrafficLoadDegreeOfConsolidation trafficLoadDegreeOfConsolidation in trafficLoadDegreeOfConsolidations) + foreach (DamSoil damSoil in trafficLoadDegreeOfConsolidations) { - if (usedSoils.Any(soil => string.Equals(soil.Name, trafficLoadDegreeOfConsolidation.SoilName, StringComparison.OrdinalIgnoreCase))) + if (usedSoils.Any(usedSoil => string.Equals(usedSoil.Name, damSoil.Name, StringComparison.OrdinalIgnoreCase))) { inputTrafficLoadDegreeOfConsolidations[index] = new InputTrafficLoadDegreeOfConsolidation { - SoilName = trafficLoadDegreeOfConsolidation.SoilName, - DegreeOfConsolidation = trafficLoadDegreeOfConsolidation.DegreeOfConsolidation + SoilName = damSoil.Name, + DegreeOfConsolidation = damSoil.TrafficLoadDegreeOfConsolidation * fractionToPercentage }; index += 1; }