Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/Results/DesignResult.cs
===================================================================
diff -u -r1013 -r1147
--- DamEngine/trunk/src/Deltares.DamEngine.Data/General/Results/DesignResult.cs (.../DesignResult.cs) (revision 1013)
+++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/Results/DesignResult.cs (.../DesignResult.cs) (revision 1147)
@@ -20,7 +20,6 @@
// All rights reserved.
using System;
-using System.Collections.Generic;
using System.IO;
using Deltares.DamEngine.Data.Design;
using Deltares.DamEngine.Data.Geotechnics;
@@ -82,49 +81,6 @@
public DesignScenario Scenario { get; set; }
///
- /// Gets or sets the length of the dike as derived value.
- /// Note: this is a placeholder, not to be part of the results as written to xml.
- /// It is currently used by the DamProjectCalculator.
- ///
- ///
- /// The length of the dike.
- ///
- public double? DikeLength
- {
- get
- {
- double? maxDikeLength = null;
- var dikeLengths = new List();
- if (Scenario != null && Scenario.Location != null)
- {
- SurfaceLine2 surfaceLine = Scenario.Location.SurfaceLine;
- if (surfaceLine != null)
- dikeLengths.Add(surfaceLine.GetDikeLength());
- }
- if (DamFailureMechanismeCalculation != null)
- {
- switch (DamFailureMechanismeCalculation.FailureMechanismSystemType)
- {
- case FailureMechanismSystemType.StabilityInside:
- if (stabilityDesignResults != null && stabilityDesignResults.RedesignedSurfaceLine != null)
- dikeLengths.Add(stabilityDesignResults.RedesignedSurfaceLine.GetDikeLength());
- break;
- case FailureMechanismSystemType.Piping:
- if (pipingDesignResults != null && pipingDesignResults.RedesignedSurfaceLine != null)
- dikeLengths.Add(pipingDesignResults.RedesignedSurfaceLine.GetDikeLength());
- break;
- }
- }
- foreach (double? dikeLength in dikeLengths)
- {
- if (dikeLength.HasValue && (!maxDikeLength.HasValue || maxDikeLength < dikeLength))
- maxDikeLength = dikeLength;
- }
- return maxDikeLength;
- }
- }
-
- ///
/// Initializes a new instance of the class.
/// Is only to be used by this.Clone() and in FillDamFromXmlOutput (used in tests), nowhere else
///
@@ -148,7 +104,6 @@
///
/// Initializes a new instance of the class.
///
- /// The identifier.
/// The dam failure mechanisme calculation specification.
/// The scenario.
/// The soil profile.
@@ -157,8 +112,11 @@
public DesignResult(DamFailureMechanismeCalculationSpecification damFailureMechanismeCalculationSpecification,
DesignScenario scenario, SoilProfile1D soilProfile, string soilGeometry2DName, AnalysisType analysisType)
{
- locationName = scenario.Location.Name;
- scenarioName = scenario.LocationScenarioID;
+ if (scenario != null)
+ {
+ locationName = scenario.Location.Name;
+ scenarioName = scenario.LocationScenarioID;
+ }
baseFileName = "";
calculationSubDir = "";
DamFailureMechanismeCalculation = damFailureMechanismeCalculationSpecification;
@@ -173,62 +131,9 @@
profileName = soilGeometry2DName;
baseFileName = damFailureMechanismeCalculationSpecification.FailureMechanismParametersMStab.MStabParameters.ProjectFileName;
baseFileName = Path.GetFileNameWithoutExtension(baseFileName);
- stabilityDesignResults = new StabilityDesignResults();
- MStabResults? mstabResults = scenario.GetMStabResults(soilProfile, soilGeometry2DName);
- stabilityDesignResults.ResultMessage = scenario.GetResultMessage(soilProfile, soilGeometry2DName);
- calculationResult = DetermineStabilityCalculationResult(stabilityDesignResults.ResultMessage, mstabResults);
- if (mstabResults != null)
- {
- baseFileName = mstabResults.Value.CalculationName;
- stabilityDesignResults.NumberOfIterations = mstabResults.Value.IterationNumber;
- stabilityDesignResults.SafetyFactor = mstabResults.Value.zone1.safetyFactor;
- stabilityDesignResults.Zone1SafetyFactor = mstabResults.Value.zone1.safetyFactor;
- stabilityDesignResults.LocalZone1EntryPointX = mstabResults.Value.zone1.entryPointXCoordinate;
- stabilityDesignResults.LocalZone1ExitPointX = mstabResults.Value.zone1.exitPointXCoordinate;
- if (mstabResults.Value.zone2 != null)
- {
- stabilityDesignResults.Zone2SafetyFactor = mstabResults.Value.zone2.Value.safetyFactor;
- stabilityDesignResults.LocalZone2EntryPointX = mstabResults.Value.zone2.Value.entryPointXCoordinate;
- stabilityDesignResults.LocalZone2ExitPointX = mstabResults.Value.zone2.Value.exitPointXCoordinate;
- }
- }
- stabilityDesignResults.RedesignedSurfaceLine = scenario.GetRedesignedSurfaceLine(soilProfile, soilGeometry2DName);
- safetyFactor = stabilityDesignResults.SafetyFactor;
- UpliftSituation? upliftSituation = scenario.GetStabilityUpliftSituation(soilProfile, soilGeometry2DName);
- if (upliftSituation != null)
- {
- stabilityDesignResults.UpliftSituation = upliftSituation;
- }
break;
-
case FailureMechanismSystemType.Piping:
- pipingDesignResults = new PipingDesignResults(damFailureMechanismeCalculationSpecification.PipingModelType);
profileName = soilProfile.Name;
- pipingDesignResults.ResultMessage = scenario.GetResultMessage(soilProfile, soilGeometry2DName);
- pipingDesignResults.RedesignedSurfaceLine = scenario.GetRedesignedSurfaceLine(soilProfile, soilGeometry2DName);
- UpliftSituation? upliftSituationPiping = scenario.GetStabilityUpliftSituation(soilProfile, soilGeometry2DName);
- if (upliftSituationPiping != null)
- {
- pipingDesignResults.UpliftSituation = upliftSituationPiping;
- }
- PipingResults? pipingResults = scenario.GetPipingResults(soilProfile, soilGeometry2DName);
- if (pipingResults != null)
- {
- baseFileName = pipingResults.Value.CalculationName;
- pipingDesignResults.BlighFactor = pipingResults.Value.BlighPipingFactor;
- pipingDesignResults.BlighHcritical = pipingResults.Value.BlighHCritical;
- pipingDesignResults.Sellmeijer4ForcesFactor = pipingResults.Value.Sellmeijer4ForcesPipingFactor;
- pipingDesignResults.Sellmeijer4ForcesHcritical = pipingResults.Value.Sellmeijer4ForcesHCritical;
- pipingDesignResults.SellmeijerVnkFactor = pipingResults.Value.SellmeijerVnkPipingFactor;
- pipingDesignResults.SellmeijerVnkHcritical = pipingResults.Value.SellmeijerVnkHCritical;
- pipingDesignResults.Wti2017Factor = pipingResults.Value.Wti2017PipingFactor;
- pipingDesignResults.Wti2017Hcritical = pipingResults.Value.Wti2017HCritical;
- pipingDesignResults.LocalExitPointX = pipingResults.Value.PipingExitPointX;
- pipingDesignResults.HeaveFactor = pipingResults.Value.HeaveFactor;
- pipingDesignResults.UpliftFactor = pipingResults.Value.UpliftFactor;
- }
- safetyFactor = pipingDesignResults.SafetyFactor();
- calculationResult = (pipingDesignResults.SafetyFactor() == null) ? CalculationResult.RunFailed : CalculationResult.Succeeded;
break;
}
}
@@ -388,26 +293,5 @@
return designResult;
}
-
- ///
- /// Determines the stability calculation run result.
- ///
- /// The result message.
- /// The mstab results.
- ///
- private CalculationResult DetermineStabilityCalculationResult(string message, MStabResults? mstabResults)
- {
- CalculationResult result;
- if ((message != null) && message.Contains("FAIL"))
- {
- result = CalculationResult.UnexpectedError;
- }
- else
- {
- // If no failure and no results, then no run has been made
- result = mstabResults != null ? CalculationResult.Succeeded : CalculationResult.NoRun;
- }
- return result;
- }
}
}
\ No newline at end of file