Index: DamClients/DamUI/trunk/src/Dam/Deltares.Dam.IntegrationTests/FailureMechanismTests.cs
===================================================================
diff -u -r4625 -r4648
--- DamClients/DamUI/trunk/src/Dam/Deltares.Dam.IntegrationTests/FailureMechanismTests.cs (.../FailureMechanismTests.cs) (revision 4625)
+++ DamClients/DamUI/trunk/src/Dam/Deltares.Dam.IntegrationTests/FailureMechanismTests.cs (.../FailureMechanismTests.cs) (revision 4648)
@@ -21,16 +21,11 @@
using System.Collections.Generic;
using Deltares.Dam.Data;
-using Deltares.Dam.Data.DamEngineIo;
using Deltares.Dam.TestHelper;
-using Deltares.DamEngine.Interface;
-using Deltares.DamEngine.Io;
-using Deltares.DamEngine.Io.XmlInput;
-using Deltares.DamEngine.Io.XmlOutput;
using Deltares.Standard;
using NUnit.Framework;
-namespace Deltares.Dam.Tests
+namespace Deltares.Dam.IntegrationTests
{
[TestFixture]
public class FailureMechanismTests
@@ -161,41 +156,14 @@
}
///
- /// Compute project
+ /// Compute stability output project
///
///
+ ///
///
private static List ComputeStabilityOutsideProjectUsingClassic(string projectFilename, int expectedLocations)
{
- // Read dikering
- using (DamProjectData damProjectData = ProjectLoader.LoadProjectData(projectFilename))
- {
- Assert.That(damProjectData.WaterBoard.Dikes.Count, Is.EqualTo(1));
- Dike dike = damProjectData.WaterBoard.Dikes[0];
- Assert.That(dike.Locations.Count, Is.EqualTo(expectedLocations));
- damProjectData.DamProjectCalculationSpecification.CurrentSpecification.StabilityModelType = MStabModelType.Bishop;
- damProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismeParamatersMStab.MStabParameters.GridPosition = MStabGridPosition.Left;
- damProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismSystemType = FailureMechanismSystemType.StabilityOutside;
- Input input = FillXmlInputFromDamUi.CreateInput(damProjectData);
- string inputXml = DamXmlSerialization.SaveInputAsXmlString(input);
- // Enable next line for debugging
- // DamXmlSerialization.SaveInputAsXmlFile("InputForDebugging.xml", input);
-
- var damEnginInterface = new EngineInterface(inputXml);
- string validationMessages = damEnginInterface.Validate();
-
- if (string.IsNullOrEmpty(validationMessages))
- {
- // only if validation is ok, then
- string outputXml = damEnginInterface.Run();
- Output output = DamXmlSerialization.LoadOutputFromXmlString(outputXml);
- // Enable next line for debugging
- // DamXmlSerialization.SaveOutputAsXmlFile("OutputForDebugging.xml", output);
- FillDamUiFromXmlOutput.AddOutputToDamProjectData(damProjectData, output);
- }
-
- return damProjectData.DesignCalculations;
- }
+ return ComputeHelper.ComputeStabilityProject(projectFilename, MStabModelType.Bishop, false, expectedLocations);
}
}
}
\ No newline at end of file
Index: DamClients/DamUI/trunk/src/Dam/Deltares.Dam.TestHelper/Deltares.Dam.TestHelper.csproj
===================================================================
diff -u -r4216 -r4648
--- DamClients/DamUI/trunk/src/Dam/Deltares.Dam.TestHelper/Deltares.Dam.TestHelper.csproj (.../Deltares.Dam.TestHelper.csproj) (revision 4216)
+++ DamClients/DamUI/trunk/src/Dam/Deltares.Dam.TestHelper/Deltares.Dam.TestHelper.csproj (.../Deltares.Dam.TestHelper.csproj) (revision 4648)
@@ -7,6 +7,12 @@
..\..\..\lib\DamEngine\Deltares.DamEngine.Data.dll
+
+ ..\..\..\lib\DamEngine\Deltares.DamEngine.Interface.dll
+
+
+ ..\..\..\lib\DamEngine\Deltares.DamEngine.Io.dll
+
..\..\..\lib\DSL-Core\Deltares.Standard.dll
Index: DamClients/DamUI/trunk/src/Dam/Deltares.Dam.TestHelper/ComputeHelper.cs
===================================================================
diff -u
--- DamClients/DamUI/trunk/src/Dam/Deltares.Dam.TestHelper/ComputeHelper.cs (revision 0)
+++ DamClients/DamUI/trunk/src/Dam/Deltares.Dam.TestHelper/ComputeHelper.cs (revision 4648)
@@ -0,0 +1,95 @@
+// Copyright (C) Stichting Deltares 2024. 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 System.Collections.Generic;
+using Deltares.Dam.Data;
+using Deltares.Dam.Data.DamEngineIo;
+using Deltares.DamEngine.Interface;
+using Deltares.DamEngine.Io;
+using Deltares.DamEngine.Io.XmlInput;
+using Deltares.DamEngine.Io.XmlOutput;
+using NUnit.Framework;
+
+namespace Deltares.Dam.TestHelper
+{
+ public class ComputeHelper
+ {
+ ///
+ /// Compute stability project
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static List ComputeStabilityProject(string projectFilename, MStabModelType modelType, bool isStabilityInside,
+ int expectedLocations, int maxCores = 1)
+ {
+ using DamProjectData damProjectData = ProjectLoader.LoadProjectData(projectFilename);
+ Assert.That(damProjectData.WaterBoard.Dikes.Count, Is.EqualTo(1));
+ Dike dike = damProjectData.WaterBoard.Dikes[0];
+ Assert.That(dike.Locations.Count, Is.EqualTo(expectedLocations));
+
+ // Specify calculation
+ damProjectData.MaxCalculationCores = maxCores;
+ damProjectData.DamProjectCalculationSpecification.CurrentSpecification.StabilityModelType = modelType;
+ damProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismeParamatersMStab
+ .MStabParameters.SearchMethod = MStabSearchMethod.Grid;
+ if (isStabilityInside)
+ {
+ damProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismeParamatersMStab
+ .MStabParameters.GridPosition = MStabGridPosition.Right;
+ damProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismSystemType = FailureMechanismSystemType.StabilityInside;
+ }
+ else
+ {
+ damProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismeParamatersMStab
+ .MStabParameters.GridPosition = MStabGridPosition.Left;
+ damProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismSystemType = FailureMechanismSystemType.StabilityOutside;
+ }
+ damProjectData.LocationJobs[0].Run = true;
+ DamProjectCalculationSpecification.SelectedAnalysisType = AnalysisType.NoAdaption;
+
+ Input input = FillXmlInputFromDamUi.CreateInput(damProjectData);
+ string inputXml = DamXmlSerialization.SaveInputAsXmlString(input);
+
+ // Enable next line for debugging
+ // DamXmlSerialization.SaveInputAsXmlFile("InputForDebugging.xml", input);
+
+ var damEngineInterface = new EngineInterface(inputXml);
+ string validationMessages = damEngineInterface.Validate();
+
+ if (string.IsNullOrEmpty(validationMessages))
+ {
+ // only if validation is ok, then
+ string outputXml = damEngineInterface.Run();
+ Output output = DamXmlSerialization.LoadOutputFromXmlString(outputXml);
+ // Enable next line for debugging
+ // DamXmlSerialization.SaveOutputAsXmlFile("OutputForDebugging.xml", output);
+ FillDamUiFromXmlOutput.AddOutputToDamProjectData(damProjectData, output);
+ }
+
+ List allCalculationResults = damProjectData.DesignCalculations;
+ return allCalculationResults;
+ }
+ }
+}
\ No newline at end of file
Index: DamClients/DamUI/trunk/src/Dam/Deltares.Dam.BenchmarkTests/DamCalculationBenchmarkTest.cs
===================================================================
diff -u -r4638 -r4648
--- DamClients/DamUI/trunk/src/Dam/Deltares.Dam.BenchmarkTests/DamCalculationBenchmarkTest.cs (.../DamCalculationBenchmarkTest.cs) (revision 4638)
+++ DamClients/DamUI/trunk/src/Dam/Deltares.Dam.BenchmarkTests/DamCalculationBenchmarkTest.cs (.../DamCalculationBenchmarkTest.cs) (revision 4648)
@@ -22,12 +22,7 @@
using System.Collections.Generic;
using System.IO;
using Deltares.Dam.Data;
-using Deltares.Dam.Data.DamEngineIo;
using Deltares.Dam.TestHelper;
-using Deltares.DamEngine.Interface;
-using Deltares.DamEngine.Io;
-using Deltares.DamEngine.Io.XmlInput;
-using Deltares.DamEngine.Io.XmlOutput;
using NUnit.Framework;
namespace Deltares.Dam.BenchmarkTests;
@@ -37,58 +32,20 @@
{
private const double tolerance3Decimals = 0.00051;
- #region SupportingMethods
-
- #endregion SupportingMethods
-
#region Uplift
///
- /// Compute project
+ /// Compute stability inside project
///
///
///
///
+ ///
///
private static List ComputeStabilityInsideProject(string projectFilename, MStabModelType modelType,
int expectedLocations, int maxCores = 1)
{
- using (DamProjectData damProjectData = ProjectLoader.LoadProjectData(projectFilename))
- {
- Assert.That(damProjectData.WaterBoard.Dikes.Count, Is.EqualTo(1));
- Dike dike = damProjectData.WaterBoard.Dikes[0];
- Assert.That(dike.Locations.Count, Is.EqualTo(expectedLocations));
-
- // Specify calculation
- damProjectData.MaxCalculationCores = maxCores;
- damProjectData.DamProjectCalculationSpecification.CurrentSpecification.StabilityModelType = modelType;
- damProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismeParamatersMStab
- .MStabParameters.GridPosition = MStabGridPosition.Right;
- damProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismeParamatersMStab
- .MStabParameters.SearchMethod = MStabSearchMethod.Grid;
- damProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismSystemType =
- FailureMechanismSystemType.StabilityInside;
- damProjectData.LocationJobs[0].Run = true;
-
- DamProjectCalculationSpecification.SelectedAnalysisType = AnalysisType.NoAdaption;
-
- Input input = FillXmlInputFromDamUi.CreateInput(damProjectData);
- string inputXml = DamXmlSerialization.SaveInputAsXmlString(input);
-
- var damEngineInterface = new EngineInterface(inputXml);
- string validationMessages = damEngineInterface.Validate();
-
- if (string.IsNullOrEmpty(validationMessages))
- {
- // only if validation is ok, then
- string outputXml = damEngineInterface.Run();
- Output output = DamXmlSerialization.LoadOutputFromXmlString(outputXml);
- FillDamUiFromXmlOutput.AddOutputToDamProjectData(damProjectData, output);
- }
-
- List allCalculationResults = damProjectData.DesignCalculations;
- return allCalculationResults;
- }
+ return ComputeHelper.ComputeStabilityProject(projectFilename, modelType, true, expectedLocations, maxCores);
}
private void RemoveCalculationDirectoriesForProject(string aProjectName)
@@ -246,7 +203,7 @@
Assert.That(allCalculationResults[1].StabilitySafetyFactor.Value, Is.EqualTo(0.964).Within(tolerance3Decimals));
Assert.That(allCalculationResults[2].StabilitySafetyFactor.Value, Is.EqualTo(0.738).Within(tolerance3Decimals));
}
-
+
///
/// Performs test on Dijkring13, 3 different scenarios are tested, with different uplift potentials
///