Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportSoilProfileWithSurfaceLine.cs =================================================================== diff -u --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportSoilProfileWithSurfaceLine.cs (revision 0) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportSoilProfileWithSurfaceLine.cs (revision 3798) @@ -0,0 +1,59 @@ +// Copyright (C) Stichting Deltares 2022. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// 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 System; +using Deltares.Geotechnics.Soils; +using SoilProfile = Deltares.Geotechnics.Soils.SoilProfile; +using SurfaceLine2 = Deltares.Geotechnics.SurfaceLines.SurfaceLine2; + +namespace Deltares.Dam.Data +{ + /// + /// Helper class to be able to (de-)serialize the 1D profile together with its belonging surface line + /// + [Serializable] + public class CsvExportSoilProfileWithSurfaceLine + { + /// + /// Gets or sets the soil profile. + /// + /// + /// The soil profile. + /// + public SoilProfile1D SoilProfile + { + get; + set; + } + + /// + /// Gets or sets the surface line. + /// + /// + /// The surface line. + /// + public SurfaceLine2 SurfaceLine + { + get; + set; + } + + } +} Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj =================================================================== diff -u -r3691 -r3798 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 3691) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 3798) @@ -169,6 +169,7 @@ + Index: DamClients/DamUI/trunk/src/Dam/Tests/DamCalculationBenchmarkTest.cs =================================================================== diff -u -r3785 -r3798 --- DamClients/DamUI/trunk/src/Dam/Tests/DamCalculationBenchmarkTest.cs (.../DamCalculationBenchmarkTest.cs) (revision 3785) +++ DamClients/DamUI/trunk/src/Dam/Tests/DamCalculationBenchmarkTest.cs (.../DamCalculationBenchmarkTest.cs) (revision 3798) @@ -172,16 +172,16 @@ /// [Test, Ignore] [Category("Slow")] - [Category(Categories.WorkInProgress)] // DamMacroStability kernel is being replaced by Macrostability kernel in DamEngine public void BM04Opdrijven05SituatieMetGrondlagenBovenEnOnderHetFreatischVlak1D() { string cFolderName = @"..\..\..\data\Dam\\Benchmarks\4 Validatie opdrijfberekeningen\05 Situatie met grondlagen boven en onder het freatisch vlak (1D)\Databronbestand.damx"; List allCalculationResults = ComputeStabilityInsideProject(cFolderName, MStabModelType.Bishop, 1); - Assert.IsFalse(allCalculationResults[0].IsUplift.Value); - Assert.AreEqual(1.512062521, allCalculationResults[0].Pl3MinUplift.Value, cTolerance); - Assert.AreEqual(43.0, allCalculationResults[0].Pl3LocalLocationXMinUplift.Value, cTolerance); + var isUplift = allCalculationResults[0].IsUplift; + Assert.IsFalse(isUplift != null && isUplift.Value); + Assert.AreEqual(null, allCalculationResults[0].Pl3MinUplift); + Assert.AreEqual(null, allCalculationResults[0].Pl3LocalLocationXMinUplift); } /// @@ -215,7 +215,7 @@ // Following values are just taken from the Geo Stability calculation and not manually calculated Assert.AreEqual(0.785, allCalculationResults[0].StabilitySafetyFactor.Value, cTolerance); - Assert.AreEqual(1.170, allCalculationResults[1].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.998, allCalculationResults[1].StabilitySafetyFactor.Value, cTolerance); Assert.AreEqual(0.792, allCalculationResults[2].StabilitySafetyFactor.Value, cTolerance); } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlOutput.cs =================================================================== diff -u -r3526 -r3798 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlOutput.cs (.../FillDamUiFromXmlOutput.cs) (revision 3526) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlOutput.cs (.../FillDamUiFromXmlOutput.cs) (revision 3798) @@ -20,6 +20,7 @@ // All rights reserved. using System.Collections.Generic; +using System.IO; using Deltares.DamEngine.Io.XmlOutput; using Deltares.Geotechnics.GeotechnicalGeometry; using Deltares.Geotechnics.Soils; @@ -151,7 +152,9 @@ ProfileName = designResult.ProfileName }; desResult.CalculationResult = ConversionHelper.ConvertToCalculationResult(designResult.CalculationResult); - desResult.Scenario = GetScenarioByName(damProjectData, designResult.LocationName, designResult.ScenarioName); + var scenario = GetScenarioByName(damProjectData, designResult.LocationName, designResult.ScenarioName); + desResult.Scenario = scenario; + desResult.LocationScenarioCount = scenario.Location.Scenarios.Count; desResult.SoilProfile = GetSoilProfileByName(damProjectData, designResult.ProfileName); if (desResult.SoilProfile == null) { @@ -212,14 +215,37 @@ if (designResult.PipingDesignResults.UpliftSituation != null) { var uplift = designResult.PipingDesignResults.UpliftSituation; - desResult.IsUplift = uplift.IsUplift; - desResult.Pl3MinUplift = uplift.Pl3MinUplift; - desResult.Pl3HeadAdjusted = uplift.Pl3HeadAdjusted; - desResult.Pl3LocalLocationXMinUplift = uplift.Pl3LocationXMinUplift; - desResult.Pl4MinUplift = uplift.Pl4MinUplift; - desResult.Pl4HeadAdjusted = uplift.Pl4HeadAdjusted; - desResult.Pl4LocalLocationXMinUplift = uplift.Pl4LocationXMinUplift; + if (desResult.IsUplift != null && desResult.IsUplift.Value) + { + desResult.IsUplift = uplift.IsUplift; + desResult.Pl3MinUplift = uplift.Pl3MinUplift; + desResult.Pl3HeadAdjusted = uplift.Pl3HeadAdjusted; + desResult.Pl3LocalLocationXMinUplift = uplift.Pl3LocationXMinUplift; + desResult.Pl4MinUplift = uplift.Pl4MinUplift; + desResult.Pl4HeadAdjusted = uplift.Pl4HeadAdjusted; + desResult.Pl4LocalLocationXMinUplift = uplift.Pl4LocationXMinUplift; + } + else + { + ResetUpliftValues(desResult); + } } + else + { + ResetUpliftValues(desResult); + } + + if (string.IsNullOrEmpty(desResult.CalculationSubDir)) + { + desResult.CalculationSubDir = Path.Combine("Piping", desResult.PipingModel.ToString()); + } + + if (string.IsNullOrEmpty(desResult.BaseFileName)) + { + desResult.BaseFileName = "Loc(" + designResult.LocationName + ")_Prof(" + designResult.ProfileName + ")_Scen(" + designResult.ScenarioName + ")"; + } + desResult.CreatePipingResultsFileForSurfaceLineAndProfile(desResult); + } private static Scenario GetScenarioByName(DamProjectData damProjectData, string locationName, string scenarioName) @@ -301,13 +327,24 @@ { var uplift = designResult.StabilityDesignResults.UpliftSituation; desResult.IsUplift = uplift.IsUplift; - desResult.Pl3MinUplift = uplift.Pl3MinUplift; - desResult.Pl3HeadAdjusted = uplift.Pl3HeadAdjusted; - desResult.Pl3LocalLocationXMinUplift = uplift.Pl3LocationXMinUplift; - desResult.Pl4MinUplift = uplift.Pl4MinUplift; - desResult.Pl4HeadAdjusted = uplift.Pl4HeadAdjusted; - desResult.Pl4LocalLocationXMinUplift = uplift.Pl4LocationXMinUplift; + if (desResult.IsUplift != null && desResult.IsUplift.Value) + { + desResult.Pl3MinUplift = uplift.Pl3MinUplift; + desResult.Pl3HeadAdjusted = uplift.Pl3HeadAdjusted; + desResult.Pl3LocalLocationXMinUplift = uplift.Pl3LocationXMinUplift; + desResult.Pl4MinUplift = uplift.Pl4MinUplift; + desResult.Pl4HeadAdjusted = uplift.Pl4HeadAdjusted; + desResult.Pl4LocalLocationXMinUplift = uplift.Pl4LocationXMinUplift; + } + else + { + ResetUpliftValues(desResult); + } } + else + { + ResetUpliftValues(desResult); + } if (designResult.StabilityDesignResults.SlipCircleDefinition != null) { @@ -362,6 +399,16 @@ } } } - } + } + + private static void ResetUpliftValues(CsvExportData desResult) + { + desResult.Pl3MinUplift = null; + desResult.Pl3HeadAdjusted = null; + desResult.Pl3LocalLocationXMinUplift = null; + desResult.Pl4MinUplift = null; + desResult.Pl4HeadAdjusted = null; + desResult.Pl4LocalLocationXMinUplift = null; + } } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportData.cs =================================================================== diff -u -r3686 -r3798 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportData.cs (.../CsvExportData.cs) (revision 3686) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportData.cs (.../CsvExportData.cs) (revision 3798) @@ -33,6 +33,7 @@ using Deltares.Geotechnics.SurfaceLines; using Deltares.Standard.Attributes; using System.Collections.Generic; +using Deltares.Standard.IO; namespace Deltares.Dam.Data { @@ -111,12 +112,61 @@ private SurfaceLine2 redesignedSurfaceLine; // redesigned Global surfaceline in use for this result (either piping or stability) private SurfaceLine2 redesignedSurfaceLineGlobal; - + + private CsvExportSoilProfileWithSurfaceLine soilProfileWithSurfaceLine; + + private double? stabilityToeAtPolderX; + private double? stabilityToeAtPolderY; + private double? stabilityShoulderHeight; + private double? zone1EntryPointX; + private double? zone1EntryPointY; + private double? zone1ExitPointX; + private double? zone1ExitPointY; + private double? zone2EntryPointX; + private double? zone2EntryPointY; + private double? zone2ExitPointX; + private double? zone2ExitPointY; + private double? dikeLength; + private double? dikeToeAtRiverXrd; + private double? dikeToeAtRiverYrd; + private double? dikeToeAtRiverZrd; + private double? dikeTopAtRiverXrd; + private double? dikeTopAtRiverYrd; + private double? dikeTopAtRiverZrd; + private double? dikeTopAtPolderXrd; + private double? dikeTopAtPolderYrd; + private double? dikeTopAtPolderZrd; + private double? dikeToeAtPolderXrd; + private double? dikeToeAtPolderYrd; + private double? dikeToeAtPolderZrd; + + private double? pipingToeAtPolderX; + private double? pipingToeAtPolderZ; + private double? pipingShoulderHeight; + private double? pl3LocationXMinUplift; + private double? pl3LocationYMinUplift; + private double? pl4LocationXMinUplift; + private double? pl4LocationYMinUplift; + private double? pipingEntryPointX; + private double? pipingEntryPointY; + private double? pipingExitPointX; + private double? pipingExitPointY; + + + /// + /// Gets or sets the exception message. + /// + /// + /// The exception message. + /// public string ExceptionMessage { get; set; } + /// + /// Initializes a new instance of the class. + /// public CsvExportData() { - // this contructor is needed for the UI table eventhough is seems not to be referenced. + redesignedSurfaceLine = null; } /// @@ -176,7 +226,7 @@ { const string wmfExtension = ".wmf"; string fullBaseFilename = DamProject.ProjectWorkingPath; - if (CalculationSubDir != "") + if (!string.IsNullOrEmpty(CalculationSubDir)) { fullBaseFilename = Path.Combine(fullBaseFilename, CalculationSubDir); } @@ -232,21 +282,21 @@ /// The piping result file. /// [Browsable(false)] - private string PipingResultFile + public string PipingResultFile { - // Path of piping is not based on the working dir but on assembly (Assembly.GetExecutingAssembly().Location) get { if (!String.IsNullOrEmpty(BaseFileName)) { - const string txtExtension = ".txt"; - string fullBaseFilename = DamProject.ProjectWorkingPath; - if (CalculationSubDir != "") + const string pipingResultFileExtension = ".prxml"; + string fullFilename = DamProject.ProjectWorkingPath; + if (string.IsNullOrEmpty(CalculationSubDir)) { - fullBaseFilename = Path.Combine(fullBaseFilename, CalculationSubDir); + CalculationSubDir = Path.Combine("Piping", PipingModel.ToString()); } - fullBaseFilename = fullBaseFilename + Path.DirectorySeparatorChar + BaseFileName; - string fullFilename = fullBaseFilename + txtExtension; + fullFilename = Path.Combine(fullFilename, CalculationSubDir); + fullFilename = fullFilename + Path.DirectorySeparatorChar + BaseFileName; + fullFilename = fullFilename + pipingResultFileExtension; return fullFilename; } return ""; @@ -269,6 +319,10 @@ { // Clone the specification to ensure a non-changeable version. damFailureMechanismeCalculationSpecification = value.Clone(); + if (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.Piping) + { + redesignedSurfaceLine = RedesignedSurfaceLine2; + } } } @@ -290,7 +344,7 @@ [Browsable(false)] public string Calculation { - get { return damFailureMechanismeCalculationSpecification != null ? damFailureMechanismeCalculationSpecification.ToString() : ""; } + get { return damFailureMechanismeCalculationSpecification?.ToString() ?? ""; } } [CsvExportColumn("Scenario", 4)] @@ -329,6 +383,13 @@ get { return scenarioName + " of " + locationScenarioCount.ToString(); } } + [Browsable(false)] + public int LocationScenarioCount + { + get { return locationScenarioCount; } + set { locationScenarioCount = value; } + } + [PropertyOrder(0, 3)] [ReadOnly(true)] public CalculationResult CalculationResult @@ -502,7 +563,7 @@ private double? GetSoilProfileProbability(FailureMechanismSystemType? failureMechanismType) { - if (soilProfile != null) + if (SoilProfile != null) { return scenario.Location.GetSoilProfileProbability(soilProfile, failureMechanismType); } @@ -562,14 +623,14 @@ { get { - if (redesignedSurfaceLineGlobal == null) - return null; - - GeometryPoint point = redesignedSurfaceLineGlobal.GetDikeToeInward(); + GeometryPoint point = redesignedSurfaceLineGlobal?.GetDikeToeInward(); if (point != null) - return point.X; - return null; + { + stabilityToeAtPolderX = point.X; + } + return stabilityToeAtPolderX; } + set => stabilityToeAtPolderX = value; } [CsvExportColumn("StabilityToeAtPolderZ", 22)] @@ -580,14 +641,14 @@ { get { - if (redesignedSurfaceLineGlobal == null) - return null; - - GeometryPoint point = redesignedSurfaceLineGlobal.GetDikeToeInward(); + GeometryPoint point = redesignedSurfaceLineGlobal?.GetDikeToeInward(); if (point != null) - return point.Z; - return null; + { + stabilityToeAtPolderY = point.Z; + } + return stabilityToeAtPolderY; } + set => stabilityToeAtPolderY = value; } [CsvExportColumn("StabilityShoulderHeight", 23)] @@ -598,14 +659,15 @@ { get { - if (redesignedSurfaceLineGlobal == null) - return null; - - GeometryPoint point = redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); + GeometryPoint point = redesignedSurfaceLineGlobal?.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); if (point != null) - return point.Z; - return null; + { + stabilityShoulderHeight = point.Z; + } + + return stabilityShoulderHeight; } + set => stabilityShoulderHeight = value; } [CsvExportColumn("StabilitySafetyFactor", 24)] @@ -657,14 +719,14 @@ { get { - if (redesignedSurfaceLineGlobal == null) - return null; - - GeometryPoint point = redesignedSurfaceLineGlobal.GetDikeToeInward(); + GeometryPoint point = redesignedSurfaceLineGlobal?.GetDikeToeInward(); if (point != null) - return point.X; - return null; + { + pipingToeAtPolderX = point.X; + } + return pipingToeAtPolderX; } + set => pipingToeAtPolderX = value; } [CsvExportColumn("PipingToeAtPolderZ", 30)] @@ -675,14 +737,14 @@ { get { - if (redesignedSurfaceLineGlobal == null) - return null; - - GeometryPoint point = redesignedSurfaceLineGlobal.GetDikeToeInward(); + GeometryPoint point = redesignedSurfaceLineGlobal?.GetDikeToeInward(); if (point != null) - return point.Z; - return null; + { + pipingToeAtPolderZ = point.Z; + } + return pipingToeAtPolderZ; } + set => pipingToeAtPolderZ = value; } [CsvExportColumn("PipingShoulderHeight", 31)] @@ -693,14 +755,15 @@ { get { - if (redesignedSurfaceLineGlobal == null) - return null; - - GeometryPoint point = redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); + GeometryPoint point = redesignedSurfaceLineGlobal?.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); if (point != null) - return point.Z; - return null; + { + pipingShoulderHeight = point.Z; + } + + return pipingShoulderHeight; } + set => pipingShoulderHeight = value; } [CsvExportColumn("DikeLength", 33)] @@ -714,10 +777,11 @@ { if (redesignedSurfaceLineGlobal != null) { - return redesignedSurfaceLineGlobal.GetDikeLength(); + dikeLength = redesignedSurfaceLineGlobal.GetDikeLength(); } - return null; + return dikeLength; } + set => dikeLength = value; } [CsvExportColumn("IsUplift", 52)] @@ -772,14 +836,20 @@ { get { - if (pl3LocalLocationXMinUplift == null || redesignedSurfaceLineGlobal == null) + if (pl3LocalLocationXMinUplift == null) return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(pl3LocalLocationXMinUplift.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); - - return point.X; + if (redesignedSurfaceLineGlobal != null) + { + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(pl3LocalLocationXMinUplift.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + if (point != null) + { + pl3LocationXMinUplift = point.X; + } + } + return pl3LocationXMinUplift; } + set => pl3LocationXMinUplift = value; } [CsvExportColumn("Pl3LocationYMinUplift", 57)] @@ -792,14 +862,20 @@ { get { - if (pl3LocalLocationXMinUplift == null || redesignedSurfaceLineGlobal == null) + if (pl3LocalLocationXMinUplift == null) return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(pl3LocalLocationXMinUplift.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); - - return point.Y; + if (redesignedSurfaceLineGlobal != null) + { + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(pl3LocalLocationXMinUplift.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + if (point != null) + { + pl3LocationYMinUplift = point.Y; + } + } + return pl3LocationYMinUplift; } + set => pl3LocationYMinUplift = value; } [CsvExportColumn("Pl4MinUplift", 58)] @@ -845,14 +921,20 @@ { get { - if (pl4LocalLocationXMinUplift == null || redesignedSurfaceLineGlobal == null) + if (pl4LocalLocationXMinUplift == null) return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(pl4LocalLocationXMinUplift.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); - - return point.X; + if (redesignedSurfaceLineGlobal != null) + { + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(pl4LocalLocationXMinUplift.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + if (point != null) + { + pl4LocationXMinUplift = point.X; + } + } + return pl4LocationXMinUplift; } + set => pl4LocationXMinUplift = value; } [CsvExportColumn("Pl4LocationYMinUplift", 62)] @@ -865,14 +947,20 @@ { get { - if (pl4LocalLocationXMinUplift == null || redesignedSurfaceLineGlobal == null) + if (pl4LocalLocationXMinUplift == null) return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(pl4LocalLocationXMinUplift.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); - - return point.Y; + if (redesignedSurfaceLineGlobal != null) + { + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(pl4LocalLocationXMinUplift.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + if (point != null) + { + pl4LocationYMinUplift = point.Y; + } + } + return pl4LocationYMinUplift; } + set => pl4LocationYMinUplift = value; } [Format("F3")] @@ -1299,10 +1387,13 @@ { if (redesignedSurfaceLineGlobal != null) { - return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X; + return redesignedSurfaceLineGlobal.CharacteristicPoints + .GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X; } - return null; + + return dikeToeAtRiverXrd; } + set => dikeToeAtRiverXrd = value; } [CsvExportColumn("DikeToeAtRiverYrd", 86)] @@ -1313,10 +1404,13 @@ { if (redesignedSurfaceLineGlobal != null) { - return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).Y; + return redesignedSurfaceLineGlobal.CharacteristicPoints + .GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).Y; } - return null; + + return dikeToeAtRiverYrd; } + set => dikeToeAtRiverYrd = value; } [CsvExportColumn("DikeToeAtRiverZrd", 87)] @@ -1327,10 +1421,13 @@ { if (redesignedSurfaceLineGlobal != null) { - return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).Z; + return redesignedSurfaceLineGlobal.CharacteristicPoints + .GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).Z; } - return null; + + return dikeToeAtRiverZrd; } + set => dikeToeAtRiverZrd = value; } [CsvExportColumn("DikeTopAtRiverXrd", 88)] @@ -1341,10 +1438,13 @@ { if (redesignedSurfaceLineGlobal != null) { - return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).X; + return redesignedSurfaceLineGlobal.CharacteristicPoints + .GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).X; } - return null; + + return dikeTopAtRiverXrd; } + set => dikeTopAtRiverXrd = value; } [CsvExportColumn("DikeTopAtRiverYrd", 89)] @@ -1355,10 +1455,13 @@ { if (redesignedSurfaceLineGlobal != null) { - return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).Y; + return redesignedSurfaceLineGlobal.CharacteristicPoints + .GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).Y; } - return null; + + return dikeTopAtRiverYrd; } + set => dikeTopAtRiverYrd = value; } [CsvExportColumn("DikeTopAtRiverZrd", 90)] @@ -1369,10 +1472,13 @@ { if (redesignedSurfaceLineGlobal != null) { - return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).Z; + return redesignedSurfaceLineGlobal.CharacteristicPoints + .GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).Z; } - return null; + + return dikeTopAtRiverZrd; } + set => dikeTopAtRiverZrd = value; } [CsvExportColumn("DikeTopAtPolderXrd", 91)] @@ -1383,10 +1489,13 @@ { if (redesignedSurfaceLineGlobal != null) { - return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X; + return redesignedSurfaceLineGlobal.CharacteristicPoints + .GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X; } - return null; + + return dikeTopAtPolderXrd; } + set => dikeTopAtPolderXrd = value; } [CsvExportColumn("DikeTopAtPolderYrd", 92)] @@ -1397,10 +1506,13 @@ { if (redesignedSurfaceLineGlobal != null) { - return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Y; + return redesignedSurfaceLineGlobal.CharacteristicPoints + .GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Y; } - return null; + + return dikeTopAtPolderYrd; } + set => dikeTopAtPolderYrd = value; } [CsvExportColumn("DikeTopAtPolderZrd", 93)] @@ -1411,10 +1523,13 @@ { if (redesignedSurfaceLineGlobal != null) { - return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z; + return redesignedSurfaceLineGlobal.CharacteristicPoints + .GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z; } - return null; + + return dikeTopAtPolderZrd; } + set => dikeTopAtPolderZrd = value; } [CsvExportColumn("DikeToeAtPolderXrd", 94)] @@ -1425,10 +1540,13 @@ { if (redesignedSurfaceLineGlobal != null) { - return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X; + return redesignedSurfaceLineGlobal.CharacteristicPoints + .GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X; } - return null; + + return dikeToeAtPolderXrd; } + set => dikeToeAtPolderXrd = value; } [CsvExportColumn("DikeToeAtPolderYrd", 95)] @@ -1439,10 +1557,13 @@ { if (redesignedSurfaceLineGlobal != null) { - return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Y; + return redesignedSurfaceLineGlobal.CharacteristicPoints + .GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Y; } - return null; + + return dikeToeAtPolderYrd; } + set => dikeToeAtPolderYrd = value; } [CsvExportColumn("DikeToeAtPolderZrd", 96)] @@ -1453,10 +1574,13 @@ { if (redesignedSurfaceLineGlobal != null) { - return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z; + return redesignedSurfaceLineGlobal.CharacteristicPoints + .GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z; } - return null; + + return dikeToeAtPolderZrd; } + set => dikeToeAtPolderZrd = value; } [CsvExportColumn("ActiveCenterPointX", 97)] @@ -1539,9 +1663,22 @@ } [Browsable(false)] + [XmlIgnore] public SoilProfile1D SoilProfile { - get { return soilProfile; } + get + { + if (soilProfile == null && damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.Piping && + File.Exists(PipingResultFile)) + { + if (soilProfileWithSurfaceLine == null) + { + soilProfileWithSurfaceLine = ReadSoilProfileWithSurfaceLineFromFile(); + } + soilProfile = soilProfileWithSurfaceLine.SoilProfile; + } + return soilProfile; + } set { soilProfile = value; @@ -1577,16 +1714,45 @@ return localRedesignedSurfaceLineGlobal; } + private CsvExportSoilProfileWithSurfaceLine ReadSoilProfileWithSurfaceLineFromFile() + { + CsvExportSoilProfileWithSurfaceLine localSoilProfileWithSurfaceLine = null; + DataEventPublisher.InvokeWithoutPublishingEvents(() => + { + var xmlDeSerializer = new Deltares.Standard.IO.Xml.XmlDeserializer(); + var classFactory = new DefaultClassFactory(); + localSoilProfileWithSurfaceLine = + (CsvExportSoilProfileWithSurfaceLine)xmlDeSerializer.XmlDeserialize(PipingResultFile, + typeof(CsvExportSoilProfileWithSurfaceLine), classFactory); + }); + return localSoilProfileWithSurfaceLine; + } + /// /// Gets or sets the redesigned surface line2. /// /// /// The redesigned surface line2. /// [Browsable(false)] + [XmlIgnore] public SurfaceLine2 RedesignedSurfaceLine2 { - get { return redesignedSurfaceLine; } + get + { + if (redesignedSurfaceLine == null && damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.Piping && + File.Exists(PipingResultFile)) + { + if (soilProfileWithSurfaceLine == null) + { + soilProfileWithSurfaceLine = ReadSoilProfileWithSurfaceLineFromFile(); + } + redesignedSurfaceLine = soilProfileWithSurfaceLine.SurfaceLine; + // Also determine and set the correct global version in order to retrieve dependend properties + redesignedSurfaceLineGlobal = CreateRedesignedSurfaceLineGlobal(); + } + return redesignedSurfaceLine; + } set { redesignedSurfaceLine = value; @@ -1851,7 +2017,7 @@ get { GeometryPoint point = null; - if (redesignedSurfaceLine != null) + if (RedesignedSurfaceLine2 != null) { point = redesignedSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver); } @@ -1872,14 +2038,21 @@ { get { - if (LocalPipingEntryPointX == null || redesignedSurfaceLineGlobal == null) + if (LocalPipingEntryPointX == null) return null; + if (redesignedSurfaceLineGlobal != null) + { + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(LocalPipingEntryPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + if (point != null) + { + pipingEntryPointX = point.X; + } + } - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(LocalPipingEntryPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); - - return point.X; + return pipingEntryPointX; } + set => pipingEntryPointX = value; } [Format("F3")] @@ -1891,14 +2064,20 @@ { get { - if (LocalPipingEntryPointX == null || redesignedSurfaceLineGlobal == null) + if (LocalPipingEntryPointX == null) return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(LocalPipingEntryPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); - - return point.Y; + if (redesignedSurfaceLineGlobal != null) + { + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(LocalPipingEntryPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + if (point != null) + { + pipingEntryPointY = point.Y; + } + } + return pipingEntryPointY; } + set => pipingEntryPointY = value; } [Format("F3")] @@ -1920,14 +2099,21 @@ { get { - if (localPipingExitPointX == null || redesignedSurfaceLineGlobal == null) + if (localPipingExitPointX == null) return null; + if (redesignedSurfaceLineGlobal != null) + { + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(localPipingExitPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + if (point != null) + { + pipingExitPointX = point.X; + } + } - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(localPipingExitPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); - - return point.X; + return pipingExitPointX; } + set => pipingExitPointX = value; } [Format("F3")] @@ -1939,14 +2125,21 @@ { get { - if (localPipingExitPointX == null || redesignedSurfaceLineGlobal == null) + if (localPipingExitPointX == null) return null; + if (redesignedSurfaceLineGlobal != null) + { + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(localPipingExitPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + if (point != null) + { + pipingExitPointY = point.Y; + } + } - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(localPipingExitPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); - - return point.Y; + return pipingExitPointY; } + set => pipingExitPointY = value; } [Format("F3")] @@ -2054,6 +2247,27 @@ } /// + /// Creates the piping results file for surface line and profile. + /// + /// The DES result. + public void CreatePipingResultsFileForSurfaceLineAndProfile(CsvExportData desResult) + { + var fullPath = Path.Combine(DamProject.ProjectMapWorkingPath, CalculationSubDir); + if (!Directory.Exists(fullPath)) + { + Directory.CreateDirectory(fullPath); + } + + var soilProfileWithSurfaceLine = new CsvExportSoilProfileWithSurfaceLine + { + SoilProfile = soilProfile, + SurfaceLine = redesignedSurfaceLine + }; + var xmlSerializer = new Deltares.Standard.IO.Xml.XmlSerializer(); + xmlSerializer.Serialize(soilProfileWithSurfaceLine, PipingResultFile); + } + + /// /// Opens the calculation file. /// public void OpenCalculationFile() Index: DamClients/DamUI/trunk/src/Dam/Tests/FailureMechanismTests.cs =================================================================== diff -u -r3527 -r3798 --- DamClients/DamUI/trunk/src/Dam/Tests/FailureMechanismTests.cs (.../FailureMechanismTests.cs) (revision 3527) +++ DamClients/DamUI/trunk/src/Dam/Tests/FailureMechanismTests.cs (.../FailureMechanismTests.cs) (revision 3798) @@ -133,7 +133,7 @@ } [Test, Ignore] - [Category(Categories.WorkInProgress)] // DamMacroStability kernel is being replaced by Macrostability kernel in DamEngine + [Category(Categories.WorkInProgress)] // DamMacroStability kernel is being replaced by Macrostability kernel in DamEngine and Stability Outside is not yet implemented. public void TestStabilityClassicOutsideWith1DProfiles() { const double diff = 0.001; @@ -162,16 +162,29 @@ Assert.AreEqual(-2.000, allCalculationresults[1].DikeTableHeight, diff); Assert.AreEqual(0.000, allCalculationresults[1].SlopeDampingPiezometricHeightPolderSide); Assert.AreEqual(14.12, allCalculationresults[1].DikeLength, diff * 10); - Assert.AreEqual(1.851, allCalculationresults[1].Pl3MinUplift, diff); - Assert.AreEqual(-5.370, allCalculationresults[1].Pl3HeadAdjusted, diff); - Assert.AreEqual(31.329, allCalculationresults[1].Pl3LocalLocationXMinUplift, diff); - Assert.AreEqual(88233.750, allCalculationresults[1].Pl3LocationXMinUplift, diff); - Assert.AreEqual(448883.620, allCalculationresults[1].Pl3LocationYMinUplift, diff); - Assert.AreEqual(0.000, allCalculationresults[1].Pl4MinUplift); - Assert.AreEqual(0.000, allCalculationresults[1].Pl4HeadAdjusted); - Assert.AreEqual(0.000, allCalculationresults[1].Pl4LocalLocationXMinUplift); - Assert.AreEqual(88209.150, allCalculationresults[1].Pl4LocationXMinUplift, diff); - Assert.AreEqual(448864.220, allCalculationresults[1].Pl4LocationYMinUplift, diff); + + // * PL3 Min uplift = null + Assert.AreEqual(null, allCalculationresults[1].Pl3MinUplift); + // * PL3 Head adjusted = null + Assert.AreEqual(null, allCalculationresults[1].Pl3HeadAdjusted); + // * PL3 Min uplift (X local) = null + Assert.AreEqual(null, allCalculationresults[1].Pl3LocalLocationXMinUplift); + // * PL3 Min uplift (X global) = null + Assert.AreEqual(null, allCalculationresults[1].Pl3LocationXMinUplift); + // * PL3 Min uplift (Y global) = null + Assert.AreEqual(null, allCalculationresults[1].Pl3LocationYMinUplift); + // * PL4 Min uplift = null + Assert.AreEqual(null, allCalculationresults[1].Pl4MinUplift); + // * PL4 Head adjusted = null + Assert.AreEqual(null, allCalculationresults[1].Pl4HeadAdjusted); + // * PL4 Min uplift (X local) = null + Assert.AreEqual(null, allCalculationresults[1].Pl4LocalLocationXMinUplift); + // * PL4 Min uplift (X global) = null + Assert.AreEqual(null, allCalculationresults[1].Pl4LocationXMinUplift); + // * PL4 Min uplift (Y global) = null + Assert.AreEqual(null, allCalculationresults[1].Pl4LocationYMinUplift); + + Assert.AreEqual(9.798, allCalculationresults[1].LocalPipingEntryPointX, diff); Assert.AreEqual(88216.844, allCalculationresults[1].PipingEntryPointX, diff); Assert.AreEqual(448870.287, allCalculationresults[1].PipingEntryPointY, diff);