Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/TestFiles/PipingVoorbeeld1_WtiSellmeijerRevisedNoPipingInputFile.xml
===================================================================
diff -u
--- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/TestFiles/PipingVoorbeeld1_WtiSellmeijerRevisedNoPipingInputFile.xml (revision 0)
+++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/TestFiles/PipingVoorbeeld1_WtiSellmeijerRevisedNoPipingInputFile.xml (revision 2158)
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/TestFiles/Rechter Diezedijk_NoStabilityInsideInputFile.xml
===================================================================
diff -u
--- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/TestFiles/Rechter Diezedijk_NoStabilityInsideInputFile.xml (revision 0)
+++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/TestFiles/Rechter Diezedijk_NoStabilityInsideInputFile.xml (revision 2158)
@@ -0,0 +1,384 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/Deltares.DamEngine.IntegrationTests.csproj
===================================================================
diff -u -r2111 -r2158
--- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/Deltares.DamEngine.IntegrationTests.csproj (.../Deltares.DamEngine.IntegrationTests.csproj) (revision 2111)
+++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/Deltares.DamEngine.IntegrationTests.csproj (.../Deltares.DamEngine.IntegrationTests.csproj) (revision 2158)
@@ -44,6 +44,7 @@
+
@@ -175,6 +176,9 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
@@ -187,6 +191,9 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs
===================================================================
diff -u -r2050 -r2158
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 2050)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 2158)
@@ -236,6 +236,15 @@
}
///
+ /// Looks up a localized string similar to No segments with failure mechanism {0} present.
+ ///
+ internal static string DesignCalculatorNoSegmentsWithFailureMechanismTypePresent {
+ get {
+ return ResourceManager.GetString("DesignCalculatorNoSegmentsWithFailureMechanismTypePresent", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to No soil profiles available for location '{0}'.
///
internal static string DesignCalculatorNoSoilProfilesAvailableForLocation {
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx
===================================================================
diff -u -r2050 -r2158
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 2050)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 2158)
@@ -306,4 +306,7 @@
No pl-lines object defined
+
+ No segments with failure mechanism {0} present
+
\ No newline at end of file
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs
===================================================================
diff -u -r2041 -r2158
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs (.../DesignCalculator.cs) (revision 2041)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs (.../DesignCalculator.cs) (revision 2158)
@@ -65,6 +65,7 @@
// Prepare the designCalculatorTasks
var designCalculatorTasks = new List();
+ var relevantCombinationsCount = 0;
for (int locationIndex = 0; locationIndex < damProjectData.Dike.Locations.Count; locationIndex++)
{
var location = damProjectData.Dike.Locations[locationIndex].Copy();
@@ -79,37 +80,56 @@
{
for (int subSoilScenarioIndex = 0; subSoilScenarioIndex < location.Segment.SoilProfileProbabilities.Count; subSoilScenarioIndex++)
{
- var soiProfileProbability = location.Segment.SoilProfileProbabilities[subSoilScenarioIndex];
- for (int designScenarioIndex = 0; designScenarioIndex < location.Scenarios.Count; designScenarioIndex++)
+ if (location.Segment.SoilProfileProbabilities[subSoilScenarioIndex].SegmentFailureMechanismType ==
+ damProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismSystemType)
{
- DesignScenario designScenario = location.Scenarios[designScenarioIndex];
- designScenario.Location = location;
- var projectPath = damProjectData.ProjectPath != "" ? damProjectData.ProjectPath : Directory.GetCurrentDirectory();
- var designResults = new List();
- var calculationMessages = new List();
- designCalculatorTasks.Add(new DesignCalculatorTask()
+ var soiProfileProbability = location.Segment.SoilProfileProbabilities[subSoilScenarioIndex];
+ for (int designScenarioIndex = 0; designScenarioIndex < location.Scenarios.Count; designScenarioIndex++)
{
- Location = location,
- SoiProfileProbability = soiProfileProbability,
- DesignScenario = designScenario,
- ProjectPath = projectPath,
- CalculationMap = damProjectData.CalculationMap,
- FailureMechanismeCalculationSpecification = damProjectData.DamProjectCalculationSpecification.CurrentSpecification.Copy(),
- DesignResults = designResults,
- CalculationMessages = calculationMessages
- });
+ DesignScenario designScenario = location.Scenarios[designScenarioIndex];
+ designScenario.Location = location;
+ var projectPath = damProjectData.ProjectPath != "" ? damProjectData.ProjectPath : Directory.GetCurrentDirectory();
+ var designResults = new List();
+ var calculationMessages = new List();
+ designCalculatorTasks.Add(new DesignCalculatorTask()
+ {
+ Location = location,
+ SoiProfileProbability = soiProfileProbability,
+ DesignScenario = designScenario,
+ ProjectPath = projectPath,
+ CalculationMap = damProjectData.CalculationMap,
+ FailureMechanismeCalculationSpecification = damProjectData.DamProjectCalculationSpecification.CurrentSpecification.Copy(),
+ DesignResults = designResults,
+ CalculationMessages = calculationMessages
+ });
+ }
+ relevantCombinationsCount++;
}
}
}
}
- // Perform the calculation
- Parallel.Run(designCalculatorTasks, RunDesignCalculatorTask, progressDelegate, damProjectData.MaxCalculationCores);
- foreach (var desigCalculatorTask in designCalculatorTasks)
+ if (relevantCombinationsCount > 0)
{
- damProjectData.CalculationMessages.AddRange(desigCalculatorTask.CalculationMessages);
- damProjectData.DesignCalculations.AddRange(desigCalculatorTask.DesignResults);
+ // Perform the calculation
+ Parallel.Run(designCalculatorTasks, RunDesignCalculatorTask, progressDelegate, damProjectData.MaxCalculationCores);
+ foreach (var desigCalculatorTask in designCalculatorTasks)
+ {
+ damProjectData.CalculationMessages.AddRange(desigCalculatorTask.CalculationMessages);
+ damProjectData.DesignCalculations.AddRange(desigCalculatorTask.DesignResults);
+ }
}
+ else
+ {
+ var logMessage = new LogMessage
+ {
+ MessageType = LogMessageType.Error,
+ Subject = null,
+ Message = string.Format(Resources.DesignCalculatorNoSegmentsWithFailureMechanismTypePresent,
+ damProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismSystemType.ToString())
+ };
+ damProjectData.CalculationMessages.Add(logMessage);
+ }
}
private void RunDesignCalculatorTask(object designCalculatorTask)
Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/DesignCalculatorTests.cs
===================================================================
diff -u
--- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/DesignCalculatorTests.cs (revision 0)
+++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/DesignCalculatorTests.cs (revision 2158)
@@ -0,0 +1,53 @@
+using System.IO;
+using System.Threading;
+using Deltares.DamEngine.Interface;
+using Deltares.DamEngine.Io;
+using NUnit.Framework;
+
+namespace Deltares.DamEngine.IntegrationTests.IntegrationTests
+{
+ public class DesignCalculatorTests
+ {
+
+ [Test]
+ [SetUICulture("en-US")]
+ public void MessageWhenNoPipingSegmentsFound()
+ {
+ // Based on ".\data\DamEngineTestProjects\PipingVoorbeeld1\PipingVoorbeeld1.damx"
+ // but without piping segments for piping
+ // Set Analysis type to "No Adaption"
+ // Set model to Piping Sellmeijer Revised (WBI)
+ // Select first location (100)
+ Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
+ const string fileName = @"TestFiles\PipingVoorbeeld1_WtiSellmeijerRevisedNoPipingInputFile.xml";
+ string inputString = File.ReadAllText(fileName);
+ EngineInterface engineInterface = new EngineInterface(inputString);
+ Assert.IsNotNull(engineInterface.DamProjectData);
+ string outputString = engineInterface.Run();
+ var output = DamXmlSerialization.LoadOutputFromXmlString(outputString);
+ Assert.AreEqual(1, output.Results.CalculationMessages.Length);
+ Assert.AreEqual(null, output.Results.CalculationResults);
+ Assert.AreEqual("No segments with failure mechanism Piping present", output.Results.CalculationMessages[0].Message1);
+ }
+
+ [Test]
+ [SetUICulture("nl-NL")]
+ public void MessageWhenNoStabilityInsideSegmentsFound()
+ {
+ // Based on ".\data\DamEngineTestProjects\Larenstein_AaenMaas\Rechter Diezedijk.damx"
+ // Set Analysis type to "No Adaption"
+ // Select Failure mechanism Stability Inside
+ // Select second location (101)
+ Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
+ const string fileName = @"TestFiles\Rechter Diezedijk_NoStabilityInsideInputFile.xml";
+ string inputString = File.ReadAllText(fileName);
+ EngineInterface engineInterface = new EngineInterface(inputString);
+ Assert.IsNotNull(engineInterface.DamProjectData);
+ string outputString = engineInterface.Run();
+ var output = DamXmlSerialization.LoadOutputFromXmlString(outputString);
+ Assert.AreEqual(1, output.Results.CalculationMessages.Length);
+ Assert.AreEqual(null, output.Results.CalculationResults);
+ Assert.AreEqual("Geen segmenten met faalmechanisme StabilityInside aanwezig", output.Results.CalculationMessages[0].Message1);
+ }
+ }
+}
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx
===================================================================
diff -u -r2050 -r2158
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 2050)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 2158)
@@ -303,4 +303,7 @@
Geen 1D ondergrond profiel gedefinieerd
+
+ Geen segmenten met faalmechanisme {0} aanwezig
+
\ No newline at end of file