Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/Deltares.DamEngine.Interface.Tests.csproj
===================================================================
diff -u -r1403 -r1471
--- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/Deltares.DamEngine.Interface.Tests.csproj (.../Deltares.DamEngine.Interface.Tests.csproj) (revision 1403)
+++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/Deltares.DamEngine.Interface.Tests.csproj (.../Deltares.DamEngine.Interface.Tests.csproj) (revision 1471)
@@ -48,6 +48,7 @@
+
Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MultiCorePipingCalculationTests.cs
===================================================================
diff -u
--- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MultiCorePipingCalculationTests.cs (revision 0)
+++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MultiCorePipingCalculationTests.cs (revision 1471)
@@ -0,0 +1,94 @@
+// Copyright (C) Stichting Deltares 2018. All rights reserved.
+//
+// This file is part of the Dam Engine.
+//
+// The Dam Engine is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero 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 Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero 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;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using Deltares.DamEngine.Data.General;
+using Deltares.DamEngine.Io;
+using Deltares.DamEngine.Io.XmlOutput;
+using Deltares.DamEngine.TestHelpers;
+using NUnit.Framework;
+
+namespace Deltares.DamEngine.Interface.Tests
+{
+ [TestFixture]
+ class MultiCorePipingCalculationTests
+ {
+ private const double tolerance = 0.0005;
+ private string DetermineOutputFilename(string prefix, string modelType, int coreCount, string extension = ".xml")
+ {
+ return String.Format("{0}_{1}_{2}core{3}_OutputFile", prefix, modelType, coreCount, extension);
+ }
+ [Test]
+ [TestCase(PipingModelType.Bligh)]
+ [TestCase(PipingModelType.Sellmeijer4Forces)]
+ [TestCase(PipingModelType.SellmeijerVnk)]
+ public void CanPerformPipingDesignWithAdaptionRechterDiezedijkMultiCore(PipingModelType pipingModelType)
+ {
+ // Based on CanPerformBlighDesignWithAdaptionRechterDiezedijk()
+ const int multiCoreCount = 4;
+ const string fileName = @"TestFiles\Rechter Diezedijk_BlighDesignInputFile.xml";
+ const string fileNameOutputPrefix = @"TestFiles\Rechter Diezedijk";
+ string inputString = File.ReadAllText(fileName);
+
+ // Set piping model type
+ inputString = XmlAdapter.ChangeValueInXml(inputString, "PipingModelType", pipingModelType.ToString());
+ // Calculate one core
+ EngineInterface engineInterface = new EngineInterface(inputString);
+ Assert.IsNotNull(engineInterface.DamProjectData);
+ string outputString = engineInterface.Run();
+ Assert.IsNotNull(outputString);
+ var outputOneCore = DamXmlSerialization.LoadOutputFromXmlString(outputString);
+ string outputFilename = DetermineOutputFilename(fileNameOutputPrefix, pipingModelType.ToString(), 1);
+ File.WriteAllText(outputFilename, outputString, Encoding.Unicode);
+
+ // Calculate multicore
+ inputString = XmlAdapter.ChangeValueInXml(inputString, "MaxCalculationCores", multiCoreCount.ToString());
+ engineInterface = new EngineInterface(inputString);
+ Assert.IsNotNull(engineInterface.DamProjectData);
+ outputString = engineInterface.Run();
+ Assert.IsNotNull(outputString);
+ var outputMultiCore = DamXmlSerialization.LoadOutputFromXmlString(outputString);
+ outputFilename = DetermineOutputFilename(fileNameOutputPrefix, pipingModelType.ToString(), multiCoreCount);
+ File.WriteAllText(outputFilename, outputString, Encoding.Unicode);
+
+ // Compare the results
+ var differences = new List();
+ StringBuilder differencesStringBuilder = new StringBuilder();
+ foreach (DesignResult oneCoreResult in outputOneCore.Results.CalculationResults.DesignResults)
+ {
+ DesignResult multiCoreResult = outputMultiCore.Results.CalculationResults.DesignResults.Where(x => x.LocationName.Equals(oneCoreResult.LocationName) && x.ProfileName.Equals(oneCoreResult.ProfileName)).FirstOrDefault();
+ Assert.NotNull(multiCoreResult);
+ if (Math.Abs(oneCoreResult.PipingDesignResults.BlighFactor - multiCoreResult.PipingDesignResults.BlighFactor) > tolerance)
+ {
+ var diffString = String.Format("Different result in {0}, {1}: 1 core = {2}, multicore = {3}", oneCoreResult.LocationName, oneCoreResult.ProfileName, oneCoreResult.PipingDesignResults.BlighFactor, multiCoreResult.PipingDesignResults.BlighFactor);
+ differencesStringBuilder.AppendLine(diffString);
+ differences.Add(diffString);
+ }
+ }
+
+ Assert.IsTrue(differences.Count == 0, "Differences found" + Environment.NewLine + differencesStringBuilder);
+ }
+ }
+}
Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/PipingBlighTests.cs
===================================================================
diff -u -r1468 -r1471
--- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/PipingBlighTests.cs (.../PipingBlighTests.cs) (revision 1468)
+++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/PipingBlighTests.cs (.../PipingBlighTests.cs) (revision 1471)
@@ -19,17 +19,11 @@
// 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 System.Linq;
-using System.Text;
using System.Threading;
using Deltares.DamEngine.Data.General;
using Deltares.DamEngine.Data.Geotechnics;
using Deltares.DamEngine.Io;
-using Deltares.DamEngine.Io.XmlOutput;
-using Deltares.DamEngine.TestHelpers;
using NUnit.Framework;
namespace Deltares.DamEngine.Interface.Tests
@@ -222,47 +216,6 @@
Assert.AreEqual(1.311, output.Results.CalculationResults.DesignResults[locationIndex * 2 + 1].PipingDesignResults.BlighFactor, tolerance);
Assert.AreEqual((locationIndex + 1) * 2, output.Results.CalculationResults.DesignResults.Length);
}
- [Test]
- public void CanPerformBlighDesignWithAdaptionRechterDiezedijkMultiCore()
- {
- // Based on CanPerformBlighDesignWithAdaptionRechterDiezedijk
- const string fileName = @"TestFiles\Rechter Diezedijk_BlighDesignInputFile.xml";
- const string fileNameOutputOneCore = @"TestFiles\Rechter Diezedijk_BlighDesignInputFileOneCoreOut.xml";
- const string fileNameOutputMultiCore = @"TestFiles\Rechter Diezedijk_BlighDesignInputFileMultiCoreOut.xml";
- string inputString = File.ReadAllText(fileName);
- // Calculate one core
- EngineInterface engineInterface = new EngineInterface(inputString);
- Assert.IsNotNull(engineInterface.DamProjectData);
- string outputString = engineInterface.Run();
- Assert.IsNotNull(outputString);
- var outputOneCore = DamXmlSerialization.LoadOutputFromXmlString(outputString);
- File.WriteAllText(fileNameOutputOneCore, outputString, Encoding.Unicode);
-
- // Calculate multicore
- inputString = XmlAdapter.ChangeValueInXml(inputString, "MaxCalculationCores", @"6");
- engineInterface = new EngineInterface(inputString);
- Assert.IsNotNull(engineInterface.DamProjectData);
- outputString = engineInterface.Run();
- Assert.IsNotNull(outputString);
- var outputMultiCore = DamXmlSerialization.LoadOutputFromXmlString(outputString);
- File.WriteAllText(fileNameOutputMultiCore, outputString, Encoding.Unicode);
-
- // Compare the results
- var differences = new List();
- StringBuilder sb = new StringBuilder();
- foreach (DesignResult oneCoreResult in outputOneCore.Results.CalculationResults.DesignResults)
- {
- DesignResult multiCoreResult = outputMultiCore.Results.CalculationResults.DesignResults.Where(x => x.LocationName.Equals(oneCoreResult.LocationName) && x.ProfileName.Equals(oneCoreResult.ProfileName)).FirstOrDefault();
- if (Math.Abs(oneCoreResult.PipingDesignResults.BlighFactor - multiCoreResult.PipingDesignResults.BlighFactor) > tolerance)
- {
- var diffString = String.Format("Different result in {0}, {1}: 1 core = {2}, multicore = {3}", oneCoreResult.LocationName, oneCoreResult.ProfileName, oneCoreResult.PipingDesignResults.BlighFactor, multiCoreResult.PipingDesignResults.BlighFactor);
- sb.AppendLine(diffString);
- differences.Add(diffString);
- }
- }
-
- Assert.IsTrue(differences.Count == 0, "Differences found" + Environment.NewLine + sb.ToString());
- }
}
}