Index: DamClients/DamUI/trunk/src/Dam/Deltares.Dam.BenchmarkTests/DamCalculationBenchmarkTest.cs =================================================================== diff -u -r4091 -r4333 --- DamClients/DamUI/trunk/src/Dam/Deltares.Dam.BenchmarkTests/DamCalculationBenchmarkTest.cs (.../DamCalculationBenchmarkTest.cs) (revision 4091) +++ DamClients/DamUI/trunk/src/Dam/Deltares.Dam.BenchmarkTests/DamCalculationBenchmarkTest.cs (.../DamCalculationBenchmarkTest.cs) (revision 4333) @@ -19,7 +19,9 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.Collections.Generic; +using System.IO; using Deltares.Dam.Data; using Deltares.Dam.Data.DamEngineIo; using Deltares.Dam.TestHelper; @@ -49,8 +51,8 @@ /// /// /// - private static List ComputeStabilityInsideProject(string projectFilename, - MStabModelType modelType, int expectedLocations) + private static List ComputeStabilityInsideProject(string projectFilename, MStabModelType modelType, + int expectedLocations, int maxCores = 1) { using (DamProjectData damProjectData = ProjectLoader.LoadProjectData(projectFilename)) { @@ -59,6 +61,7 @@ Assert.AreEqual(expectedLocations, dike.Locations.Count); // Specify calculation + damProjectData.MaxCalculationCores = maxCores; damProjectData.DamProjectCalculationSpecification.CurrentSpecification.StabilityModelType = modelType; damProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismeParamatersMStab .MStabParameters.GridPosition = MStabGridPosition.Right; @@ -89,18 +92,27 @@ } } + private void RemoveCalculationDirectoriesForProject(string aProjectName) + { + string folderName = aProjectName.Replace(".damx", ".Calc"); + if (Directory.Exists(folderName)) + { + const bool recursive = true; + Directory.Delete(folderName, recursive); + } + } + /// /// Performs test BM04Opdijven01 situation without uplift 1D /// [Test] [Category("Slow")] - [Category("Work_In_Progress")] - [Ignore("DamMacroStability kernel is being replaced by Macrostability kernel in DamEngine")] public void BM04Opdrijven01SituatieZonderOpdrijven1D() { const string cFolderName = - @"..\..\..\data\Dam\\Benchmarks\4 Validatie opdrijfberekeningen\01 Situatie zonder opdrijven (1D)\Databronbestand.damx"; - List allCalculationResults = ComputeStabilityInsideProject(cFolderName, MStabModelType.Bishop, 1); + @"..\..\..\..\..\data\Dam\\Benchmarks\4 Validatie opdrijfberekeningen\01 Situatie zonder opdrijven (1D)\Databronbestand.damx"; + RemoveCalculationDirectoriesForProject(cFolderName); + List allCalculationResults = ComputeStabilityInsideProject(cFolderName, MStabModelType.UpliftVan, 1); Assert.IsTrue(allCalculationResults[0].IsUplift.Value); Assert.AreEqual(1.024077029, allCalculationResults[0].Pl3MinUplift.Value, cTolerance); @@ -113,13 +125,12 @@ /// [Test] [Category("Slow")] - [Category("Work_In_Progress")] - [Ignore("DamMacroStability kernel is being replaced by Macrostability kernel in DamEngine")] public void BM04Opdrijven02SituatieMetOpdrijven1D() { const string cFolderName = - @"..\..\..\data\Dam\\Benchmarks\4 Validatie opdrijfberekeningen\02 Situatie met opdrijven (1D)\Databronbestand.damx"; - List allCalculationResults = ComputeStabilityInsideProject(cFolderName, MStabModelType.Bishop, 1); + @"..\..\..\..\..\data\Dam\\Benchmarks\4 Validatie opdrijfberekeningen\02 Situatie met opdrijven (1D)\Databronbestand.damx"; + RemoveCalculationDirectoriesForProject(cFolderName); + List allCalculationResults = ComputeStabilityInsideProject(cFolderName, MStabModelType.UpliftVan, 1); Assert.IsTrue(allCalculationResults[0].IsUplift.Value); Assert.AreEqual(0.905914295, allCalculationResults[0].Pl3MinUplift.Value, cTolerance); @@ -132,13 +143,12 @@ /// [Test] [Category("Slow")] - [Category("Work_In_Progress")] - [Ignore("DamMacroStability kernel is being replaced by Macrostability kernel in DamEngine")] public void BM04Opdrijven03SituatieMetEenLabielEvenwicht1D() { const string cFolderName = - @"..\..\..\data\Dam\\Benchmarks\4 Validatie opdrijfberekeningen\03 Situatie met een labiel evenwicht (1D)\Databronbestand.damx"; - List allCalculationResults = ComputeStabilityInsideProject(cFolderName, MStabModelType.Bishop, 1); + @"..\..\..\..\..\data\Dam\\Benchmarks\4 Validatie opdrijfberekeningen\03 Situatie met een labiel evenwicht (1D)\Databronbestand.damx"; + RemoveCalculationDirectoriesForProject(cFolderName); + List allCalculationResults = ComputeStabilityInsideProject(cFolderName, MStabModelType.UpliftVan, 1); Assert.IsTrue(allCalculationResults[0].IsUplift.Value); Assert.AreEqual(1.0, allCalculationResults[0].Pl3MinUplift.Value, cTolerance); @@ -151,17 +161,16 @@ /// [Test] [Category("Slow")] - [Category("Work_In_Progress")] - [Ignore("DamMacroStability kernel is being replaced by Macrostability kernel in DamEngine")] public void BM04Opdrijven04SituatieMetEenSchuineSlootbodemEnOpdrijvenOp1Locatie1D() { const string cFolderName = - @"..\..\..\data\Dam\Benchmarks\4 Validatie opdrijfberekeningen\04 Situatie met een schuine slootbodem en opdrijven op 1 locatie (1D)\Databronbestand.damx"; - List allCalculationResults = ComputeStabilityInsideProject(cFolderName, MStabModelType.Bishop, 1); + @"..\..\..\..\..\data\Dam\Benchmarks\4 Validatie opdrijfberekeningen\04 Situatie met een schuine slootbodem en opdrijven op 1 locatie (1D)\Databronbestand.damx"; + RemoveCalculationDirectoriesForProject(cFolderName); + List allCalculationResults = ComputeStabilityInsideProject(cFolderName, MStabModelType.UpliftVan, 1); Assert.IsTrue(allCalculationResults[0].IsUplift.Value); - Assert.AreEqual(0.969283045, allCalculationResults[0].Pl3MinUplift.Value, cTolerance); - Assert.AreEqual(-1.6382263, allCalculationResults[0].Pl3HeadAdjusted.Value, cTolerance); + Assert.AreEqual(0.852055725, allCalculationResults[0].Pl3MinUplift.Value, cTolerance); + Assert.AreEqual(-2.1657492, allCalculationResults[0].Pl3HeadAdjusted.Value, cTolerance); Assert.AreEqual(49.1, allCalculationResults[0].Pl3LocalLocationXMinUplift.Value, cTolerance); } @@ -170,11 +179,11 @@ /// [Test] [Category("Slow")] - [Ignore("DamMacroStability kernel is being replaced by Macrostability kernel in DamEngine")] public void BM04Opdrijven05SituatieMetGrondlagenBovenEnOnderHetFreatischVlak1D() { const string cFolderName = - @"..\..\..\data\Dam\\Benchmarks\4 Validatie opdrijfberekeningen\05 Situatie met grondlagen boven en onder het freatisch vlak (1D)\Databronbestand.damx"; + @"..\..\..\..\..\data\Dam\\Benchmarks\4 Validatie opdrijfberekeningen\05 Situatie met grondlagen boven en onder het freatisch vlak (1D)\Databronbestand.damx"; + RemoveCalculationDirectoriesForProject(cFolderName); List allCalculationResults = ComputeStabilityInsideProject(cFolderName, MStabModelType.Bishop, 1); bool? isUplift = allCalculationResults[0].IsUplift; @@ -188,13 +197,12 @@ /// [Test] [Category("Slow")] - [Category("Work_In_Progress")] - [Ignore("DamMacroStability kernel is being replaced by Macrostability kernel in DamEngine")] public void BM04Opdrijven06SituatieMetOpdrijvenOpVerschillendeLocatiesLangsHetProfiel1D() { const string cFolderName = - @"..\..\..\data\Dam\Benchmarks\4 Validatie opdrijfberekeningen\06 Situatie met verschillende opdrijflocaties (1D)\Databronbestand.damx"; - List allCalculationResults = ComputeStabilityInsideProject(cFolderName, MStabModelType.Bishop, 1); + @"..\..\..\..\..\data\Dam\Benchmarks\4 Validatie opdrijfberekeningen\06 Situatie met verschillende opdrijflocaties (1D)\Databronbestand.damx"; + RemoveCalculationDirectoriesForProject(cFolderName); + List allCalculationResults = ComputeStabilityInsideProject(cFolderName, MStabModelType.UpliftVan, 1); Assert.IsTrue(allCalculationResults[0].IsUplift.Value); // Values at bottom ditch dikeside @@ -208,10 +216,13 @@ /// [Test] [Category("Slow")] - public void Dijkring13NormalStabilityCalculation() + [TestCase(1)] + [TestCase(5)] + public void Dijkring13NormalStabilityCalculationBishop(int maxCores) { const string cDikeFolder = @"..\..\..\..\..\data\Dam\Benchmarks\4 Validatie opdrijfberekeningen\Dijkring13-Sec1\Databronbestand.damx"; - List allCalculationResults = ComputeStabilityInsideProject(cDikeFolder, MStabModelType.Bishop, 1); + RemoveCalculationDirectoriesForProject(cDikeFolder); + List allCalculationResults = ComputeStabilityInsideProject(cDikeFolder, MStabModelType.Bishop, 1, maxCores); // Following values are just taken from the Geo Stability calculation and not manually calculated Assert.AreEqual(0.785, allCalculationResults[0].StabilitySafetyFactor.Value, cTolerance); @@ -220,6 +231,74 @@ } /// + /// Performs test on Dijkring13, 3 different scenarios are tested, with different uplift potentials + /// + [Test] + [Category("Slow")] + [TestCase(1)] + [TestCase(5)] + public void Dijkring13NormalStabilityCalculation(int maxCores) + { + const string cDikeFolder = @"..\..\..\..\..\data\Dam\Benchmarks\4 Validatie opdrijfberekeningen\Dijkring13-Sec1\Databronbestand.damx"; + RemoveCalculationDirectoriesForProject(cDikeFolder); + List allCalculationResults = ComputeStabilityInsideProject(cDikeFolder, MStabModelType.UpliftVan, 1, maxCores); + + // Following values are just taken from the Geo Stability calculation and not manually calculated + Assert.AreEqual(0.696, allCalculationResults[0].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.964, allCalculationResults[1].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.738, allCalculationResults[2].StabilitySafetyFactor.Value, cTolerance); + } + + /// + /// Performs test on Dijkring13, 3 different scenarios are tested, with different uplift potentials + /// + [Test] + [Category("Slow")] + [TestCase(1)] + [TestCase(5)] + [TestCase(10)] + public void Dijkring13NormalStabilityCalculationMultiCoreForMultiLocations(int maxCores) + { + const string cDikeFolder = @"..\..\..\..\..\data\Dam\Benchmarks\4 Validatie opdrijfberekeningen\Dijkring13-Sec1\DatabronbestandMulti.damx"; + RemoveCalculationDirectoriesForProject(cDikeFolder); + List allCalculationResults = ComputeStabilityInsideProject(cDikeFolder, MStabModelType.UpliftVan, 10, maxCores); + + // Following values are just taken from the Geo Stability calculation and not manually calculated + Assert.AreEqual(30, allCalculationResults.Count); + Assert.AreEqual(0.696, allCalculationResults[0].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.964, allCalculationResults[1].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.738, allCalculationResults[2].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.695, allCalculationResults[3].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.962, allCalculationResults[4].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.737, allCalculationResults[5].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.694, allCalculationResults[6].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.961, allCalculationResults[7].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.734, allCalculationResults[8].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.693, allCalculationResults[9].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.960, allCalculationResults[10].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.732, allCalculationResults[11].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.692, allCalculationResults[12].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.959, allCalculationResults[13].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.732, allCalculationResults[14].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.692, allCalculationResults[15].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.959, allCalculationResults[16].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.731, allCalculationResults[17].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.690, allCalculationResults[18].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.957, allCalculationResults[19].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.729, allCalculationResults[20].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.689, allCalculationResults[21].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.957, allCalculationResults[22].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.728, allCalculationResults[23].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.688, allCalculationResults[24].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.956, allCalculationResults[25].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.726, allCalculationResults[26].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.687, allCalculationResults[27].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.954, allCalculationResults[28].StabilitySafetyFactor.Value, cTolerance); + Assert.AreEqual(0.725, allCalculationResults[29].StabilitySafetyFactor.Value, cTolerance); + } + + + /// /// Performs test BMStabilityInwardsNoAdaptation /// [Test] @@ -229,6 +308,7 @@ const string cFolderName = @"..\..\..\..\..\data\Dam\\Benchmarks\Validatie UpliftVan\StabilityInwards-NoAdaptation\Databronbestand.damx"; List allCalculationResults = ComputeStabilityInsideProject(cFolderName, MStabModelType.UpliftVan, 1); + RemoveCalculationDirectoriesForProject(cFolderName); Assert.IsTrue(allCalculationResults[0].IsUplift.Value); Assert.AreEqual(0.767, allCalculationResults[0].StabilitySafetyFactor.Value, cTolerance);