Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelper.cs =================================================================== diff -u -r5125 -r5126 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelper.cs (.../MacroStabilityCommonHelper.cs) (revision 5125) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelper.cs (.../MacroStabilityCommonHelper.cs) (revision 5126) @@ -562,20 +562,23 @@ /// /// Writes the stix file based on input and results search grid. + /// For Uplift-Van with Grid, the stix file is not written because this combination is not possible in D-Stability. /// /// Name of the file. /// The input. private static void WriteStixFileBasedOnInputAndResultsSearchGrid(string fileName, MacroStabilityInput input) { - if (!(input.StabilityModel.ModelOption == StabilityModelOptionType.UpliftVan && - input.StabilityModel.SearchAlgorithm == SearchAlgorithm.Beeswarm)) + if (input.StabilityModel.ModelOption == StabilityModelOptionType.UpliftVan && + input.StabilityModel.SearchAlgorithm == SearchAlgorithm.Grid) { - string fileNameForCalculationAsStix = DetermineStixFilename(fileName, "input"); - var inputStixFile = new StixWriter(); - inputStixFile.FillInfo("DAM Engine", Path.GetDirectoryName(fileName), - Path.GetFileName(fileName), true); - StixFileWrite(inputStixFile, fileNameForCalculationAsStix, input); + return; } + + string fileNameForCalculationAsStix = DetermineStixFilename(fileName, "input"); + var inputStixFile = new StixWriter(); + inputStixFile.FillInfo("DAM Engine", Path.GetDirectoryName(fileName), + Path.GetFileName(fileName), true); + StixFileWrite(inputStixFile, fileNameForCalculationAsStix, input); } /// Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs =================================================================== diff -u -r5125 -r5126 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 5125) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 5126) @@ -781,7 +781,9 @@ } [Test, Category(Categories.Slow)] - public void TestRunMacroStabilityDeltaDijkUpliftVanWith1DProducesStixFiles() + [TestCase(MStabSearchMethod.BeeSwarm, 4, 1.613, 1.535)] + [TestCase(MStabSearchMethod.Grid, 2, 1.611, 1.536)] + public void TestRunMacroStabilityDeltaDijkUpliftVanWith1DProducesStixFiles(MStabSearchMethod searchMethod, int expectedStixFileCount, double expectedSafetyFactor1, double expectedSafetyFactor2) { // Expected results are taken as is from the first run with the new kernel // Selected location (6-4-1-A-1-F) @@ -805,7 +807,9 @@ inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DeltaDijk normal.geometries2D.0\"); inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DeltaDijk normal0.soilmaterials.mdb"); - Output output = GeneralHelper.RunAfterInputValidation(inputString); + var engineInterface = new EngineInterface(inputString); + engineInterface.DamProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismParametersMStab.MStabParameters.SearchMethod = searchMethod; + Output output = GeneralHelper.RunAfterInputValidation(engineInterface); // one location is calculated with 3 1D profiles // However, profile 6-4-1-A-1-F_3_s has no UpliftVan occuring and thus has no result @@ -817,7 +821,7 @@ DesignResult result = output.Results.CalculationResults[0]; // SafetyFactor=1.638 DSTAB 1.518 (1.079) - Assert.That(result.StabilityDesignResults.SafetyFactor, Is.EqualTo(1.611).Within(tolerance)); + Assert.That(result.StabilityDesignResults.SafetyFactor, Is.EqualTo(expectedSafetyFactor1).Within(tolerance)); // skip testing some of the results like uplift etc. @@ -828,25 +832,32 @@ result = output.Results.CalculationResults[1]; Assert.Multiple(() => { - Assert.That(result.StabilityDesignResults.SafetyFactor, Is.EqualTo(1.536).Within(tolerance)); + Assert.That(result.StabilityDesignResults.SafetyFactor, Is.EqualTo(expectedSafetyFactor2).Within(tolerance)); Assert.That(ConversionHelper.ConvertToCalculationResult(result.CalculationResult), Is.EqualTo(CalculationResult.Succeeded)); }); var fileList = new List { - "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_input.stix", - "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_input.stix", "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_result.stix", "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_result.stix" }; + if (searchMethod == MStabSearchMethod.BeeSwarm) + { + fileList.Add("Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_input.stix"); + fileList.Add("Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_input.stix"); + } + int stixFileCount = Directory.GetFiles(Path.GetFullPath(calcDir), "*.stix", SearchOption.AllDirectories).Length; + Assert.That(stixFileCount, Is.EqualTo(expectedStixFileCount),"The number of created STIX files is not as expected"); foreach (string file in fileList.Select(file => Path.Combine(Path.GetFullPath(calcDir), file))) { Assert.That(File.Exists(file), Is.True, file + " does not exist"); } } [Test, Category(Categories.Slow)] - public void TestRunMacroStabilityDeltaDijkBishopUpliftVanWith1DWithUpliftProducesStixFiles() + [TestCase(MStabSearchMethod.BeeSwarm, 10, 1.613, 1.535)] + [TestCase(MStabSearchMethod.Grid, 8, 1.611, 1.536)] + public void TestRunMacroStabilityDeltaDijkBishopUpliftVanWith1DWithUpliftProducesStixFiles(MStabSearchMethod searchMethod, int expectedStixFileCount, double expectedSafetyFactor1, double expectedSafetyFactor2) { // Expected results are taken as is from the first run with the new kernel // This tests use of 1D profiles @@ -869,7 +880,9 @@ inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DeltaDijk normal.geometries2D.0\"); inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DeltaDijk normal0.soilmaterials.mdb"); - Output output = GeneralHelper.RunAfterInputValidation(inputString); + var engineInterface = new EngineInterface(inputString); + engineInterface.DamProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismParametersMStab.MStabParameters.SearchMethod = searchMethod; + Output output = GeneralHelper.RunAfterInputValidation(engineInterface); // one location is calculated with 3 1D profiles Assert.That(output.Results.CalculationResults, Has.Length.EqualTo(3)); @@ -887,7 +900,7 @@ Assert.Multiple(() => { // SafetyFactor=1.638 - Assert.That(result.StabilityDesignResults.SafetyFactor, Is.EqualTo(1.611).Within(tolerance)); + Assert.That(result.StabilityDesignResults.SafetyFactor, Is.EqualTo(expectedSafetyFactor1).Within(tolerance)); // skip testing some of the results like uplift etc. @@ -897,20 +910,27 @@ // test safety factor for other profiles result = output.Results.CalculationResults[1]; - Assert.That(result.StabilityDesignResults.SafetyFactor, Is.EqualTo(1.536).Within(tolerance)); + Assert.That(result.StabilityDesignResults.SafetyFactor, Is.EqualTo(expectedSafetyFactor2).Within(tolerance)); // Stix file var fileList = new List { "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_input.stix", "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_input.stix", - "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_input.stix", - "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_input.stix", + "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_3_s)_input.stix", "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_result.stix", "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_result.stix", + "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_3_s)_result.stix", "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_result.stix", "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_result.stix" }; + if (searchMethod == MStabSearchMethod.BeeSwarm) + { + fileList.Add("Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_input.stix"); + fileList.Add("Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_input.stix"); + } + int stixFileCount = Directory.GetFiles(Path.GetFullPath(calcDir), "*.stix", SearchOption.AllDirectories).Length; + Assert.That(stixFileCount, Is.EqualTo(expectedStixFileCount),"The number of created STIX files is not as expected"); foreach (string file in fileList.Select(file => Path.Combine(Path.GetFullPath(calcDir), file))) { Assert.That(File.Exists(file), Is.True, file + " does not exist");