Index: DamClients/DamUI/trunk/src/Dam/Deltares.Dam.TestHelper/ComputeHelper.cs
===================================================================
diff -u -r6793 -r6798
--- DamClients/DamUI/trunk/src/Dam/Deltares.Dam.TestHelper/ComputeHelper.cs (.../ComputeHelper.cs) (revision 6793)
+++ DamClients/DamUI/trunk/src/Dam/Deltares.Dam.TestHelper/ComputeHelper.cs (.../ComputeHelper.cs) (revision 6798)
@@ -27,36 +27,49 @@
using Deltares.DamEngine.Io.XmlInput;
using Deltares.DamEngine.Io.XmlOutput;
using Deltares.Standard.Logging;
+using DGeoSuite.Common;
using NUnit.Framework;
namespace Deltares.Dam.TestHelper
{
+ ///
+ /// Input parameters for computing a stability project
+ ///
+ public class ComputeStabilityProjectParameters
+ {
+ public List LocationNames { get; set; } = null;
+ public StabilityModelType ModelType { get; set; } = StabilityModelType.Bishop;
+ public bool IsStabilityInside { get; set; } = true;
+ public int ExpectedLocations { get; set; } = 1;
+ public int MaxCores { get; set; } = 1;
+ }
+
+ ///
+ /// Helper class to compute stability projects
+ ///
public class ComputeHelper
{
///
/// Compute stability project
///
- ///
- ///
- ///
- ///
- ///
- ///
+ /// The filename of the project to compute
+ /// Parameteres to compute a stability project
+ /// The log messages of the computation
///
- public static List ComputeStabilityProject(string projectFilename, StabilityModelType modelType, bool isStabilityInside,
- int expectedLocations, int maxCores, out List logMessages)
+ public static List ComputeStabilityProject(string projectFilename, ComputeStabilityProjectParameters computeStabilityProjectParameters,
+ out List logMessages)
{
using DamProjectData damProjectData = ProjectLoader.LoadProjectData(projectFilename);
Assert.That(damProjectData.WaterBoard.Dikes.Count, Is.EqualTo(1));
Dike dike = damProjectData.WaterBoard.Dikes[0];
- Assert.That(dike.Locations.Count, Is.EqualTo(expectedLocations));
+ Assert.That(dike.Locations.Count, Is.EqualTo(computeStabilityProjectParameters.ExpectedLocations));
// Specify calculation
- damProjectData.MaxCalculationCores = maxCores;
- damProjectData.DamProjectCalculationSpecification.CurrentSpecification.StabilityModelType = modelType;
+ damProjectData.MaxCalculationCores = computeStabilityProjectParameters.MaxCores;
+ damProjectData.DamProjectCalculationSpecification.CurrentSpecification.StabilityModelType = computeStabilityProjectParameters.ModelType;
damProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismeParamatersMStab
.MStabParameters.SearchMethod = StabilitySearchMethod.Grid;
- if (isStabilityInside)
+ if (computeStabilityProjectParameters.IsStabilityInside)
{
damProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismSystemType = FailureMechanismSystemType.StabilityInside;
}
@@ -65,10 +78,21 @@
damProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismSystemType = FailureMechanismSystemType.StabilityOutside;
}
- foreach (var locationJob in damProjectData.LocationJobs)
+ // Determine locations to calculate
+ foreach (LocationJob locationJob in damProjectData.LocationJobs)
{
- locationJob.Run = true;
+ if (computeStabilityProjectParameters.LocationNames.IsNullOrEmpty())
+ {
+ // If no location names specified, run all locations
+ locationJob.Run = true;
+ }
+ else
+ {
+ // Only run specified locations
+ locationJob.Run = computeStabilityProjectParameters.LocationNames.Contains(locationJob.Location.Name);
+ }
}
+
DamProjectCalculationSpecification.SelectedAnalysisType = AnalysisType.NoAdaption;
Input input = FillXmlInputFromDamUi.CreateInput(damProjectData);