Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/Deltares.DamEngine.IntegrationTests.csproj =================================================================== diff -u -r3651 -r3666 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/Deltares.DamEngine.IntegrationTests.csproj (.../Deltares.DamEngine.IntegrationTests.csproj) (revision 3651) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/Deltares.DamEngine.IntegrationTests.csproj (.../Deltares.DamEngine.IntegrationTests.csproj) (revision 3666) @@ -76,6 +76,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs =================================================================== diff -u -r3657 -r3666 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 3657) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 3666) @@ -55,6 +55,7 @@ RemoveUsedDirectoryAfterTests("TestRunFailedExpectCalculationMessageInOptimizedSlopeAndShoulderAdaption"); RemoveUsedDirectoryAfterTests("TestRunFailedExpectCalculationMessageInSlopeAdaptionBeforeShoulderAdaption"); RemoveUsedDirectoryAfterTests("TestGiveFeedBackWhenNoProfilesAreAvailable"); + RemoveUsedDirectoryAfterTests("TestStabInwardsBishopWithStixFiles"); } private void RemoveUsedDirectoryAfterTests(string directory) @@ -710,6 +711,133 @@ Assert.AreEqual(2, output.Results.CalculationMessages.Length, Tolerance); } + [Test, Category("Slow")] + public void TestRunMacroStabilityDeltaDijkBishopWith1DProducesStixFiles() + { + // Expected results are taken as is from the first run with the new kernel + // This tests use of 1D profiles + // Selected location (6-4-1-A-1-F) + // Analysis type "No adaption" + // Calculation options: Stability Inside - Bishop + const string calcDir = "TestStabInwardsBishopWithStixFiles"; + if (Directory.Exists(calcDir)) + { + Directory.Delete(calcDir, true); // delete previous results + } + + Directory.CreateDirectory(calcDir); + + + const string fileName = @"TestFiles\DeltaDijkBishopInwards.xml"; + string inputString = File.ReadAllText(fileName); + inputString = ChangeInputModel(inputString, InputStabilityModelType.Bishop); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DeltaDijk normal.geometries2D.0\"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DeltaDijk normal0.soilmaterials.mdb"); + EngineInterface engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); + + string outputString = engineInterface.Run(); + + Assert.IsNotNull(outputString); + var output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + + // one location is calculated with 3 1D profiles + Assert.AreEqual(3, output.Results.CalculationResults.Length); + Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[0].LocationName); + Assert.AreEqual("6-4-1-A-1-F_1_s", output.Results.CalculationResults[0].ProfileName); + Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[1].LocationName); + Assert.AreEqual("6-4-1-A-1-F_2_s", output.Results.CalculationResults[1].ProfileName); + Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[2].LocationName); + Assert.AreEqual("6-4-1-A-1-F_3_s", output.Results.CalculationResults[2].ProfileName); + + var result = output.Results.CalculationResults[0]; + // SafetyFactor=1.682 + Assert.AreEqual(1.682, result.StabilityDesignResults.SafetyFactor, Tolerance); + + // skip testing some of the results like uplift etc. + + // Calculation Result + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + + // test safety factor for other profiles + result = output.Results.CalculationResults[1]; + // SafetyFactor=1.644 + Assert.AreEqual(1.644, result.StabilityDesignResults.SafetyFactor, Tolerance); + result = output.Results.CalculationResults[2]; + // SafetyFactor=1.682 + Assert.AreEqual(1.682, result.StabilityDesignResults.SafetyFactor, Tolerance); + + // Stix file + var file1 = Path.Combine(Path.GetFullPath(calcDir), "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_result.stix"); + Assert.IsTrue(File.Exists(file1)); + var file2 = Path.Combine(Path.GetFullPath(calcDir), "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_result.stix"); + Assert.IsTrue(File.Exists(file2)); + var file3 = Path.Combine(Path.GetFullPath(calcDir), "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_3_s)_result.stix"); + Assert.IsTrue(File.Exists(file3)); + } + + [Test, Category("Slow")] + public void TestRunMacroStabilityDeltaDijkUpliftVanWith1DProducesStixFiles() + { + // Expected results are taken as is from the first run with the new kernel + // Selected location (6-4-1-A-1-F) + // Analysis type "No adaption" + // Calculation options: Stability Inside - UpliftVan + // This tests use of 1D profiles + const string calcDir = "TestStabInwardsZoneUpliftVan"; + if (Directory.Exists(calcDir)) + { + Directory.Delete(calcDir, true); // delete previous results + } + + Directory.CreateDirectory(calcDir); + + // Read as Bishop, then change to UpliftVan + const string fileName = @"TestFiles\DeltaDijkBishopInwards.xml"; + string inputString = File.ReadAllText(fileName); + inputString = ChangeInputModel(inputString, InputStabilityModelType.UpliftVan); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DeltaDijk normal.geometries2D.0\"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DeltaDijk normal0.soilmaterials.mdb"); + EngineInterface engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); + + string outputString = engineInterface.Run(); + + Assert.IsNotNull(outputString); + var output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + + // 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 + Assert.AreEqual(2, output.Results.CalculationResults.Length); + Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[0].LocationName); + Assert.AreEqual("6-4-1-A-1-F_1_s", output.Results.CalculationResults[0].ProfileName); + Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[1].LocationName); + Assert.AreEqual("6-4-1-A-1-F_2_s", output.Results.CalculationResults[1].ProfileName); + + var result = output.Results.CalculationResults[0]; + // SafetyFactor=1.638 DSTAB 1.518 (1.079) + Assert.AreEqual(1.638, result.StabilityDesignResults.SafetyFactor, Tolerance); + + // skip testing some of the results like uplift etc. + + // Calculation Result + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + + // test safety factor for other profiles + result = output.Results.CalculationResults[1]; + // SafetyFactor=1.551 DSTAB 1.414. 1.097 + Assert.AreEqual(1.551, result.StabilityDesignResults.SafetyFactor, Tolerance); + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + var file1 = Path.Combine(Path.GetFullPath(calcDir), "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_result.stix"); + Assert.IsTrue(File.Exists(file1)); + var file2 = Path.Combine(Path.GetFullPath(calcDir), "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_result.stix"); + Assert.IsTrue(File.Exists(file2)); + } + private static string GetOutputStringForProject(string analysisType) { const string calcDir = "TestStabInwardsBishop";