Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityCommon/DamMacroStabilityUtils.cs
===================================================================
diff -u
--- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityCommon/DamMacroStabilityUtils.cs (revision 0)
+++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityCommon/DamMacroStabilityUtils.cs (revision 822)
@@ -0,0 +1,63 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using Deltares.DamEngine.Calculators.KernelWrappers.Common;
+using Deltares.DamEngine.Data.General;
+
+namespace Deltares.DamEngine.Calculators.KernelWrappers.DamMacroStabilityCommon
+{
+ public class DamMacroStabilityUtils
+ {
+ public static string GetStabilityInputFileName(DamKernelInput damKernelInput, int iterationIndex,
+ MStabModelType model)
+ {
+ // Assume 2D sti-file, then check on type being 1D
+ string soilGeometryName = damKernelInput.SubSoilScenario.StiFileName;
+ if (damKernelInput.SubSoilScenario.SoilProfileType == SoilProfileType.ProfileType1D)
+ {
+ soilGeometryName = damKernelInput.SubSoilScenario.SoilProfile1DName;
+ }
+
+ string calculationName = DetermineCalculationFilename(damKernelInput.DesignScenario.Location.Name,
+ damKernelInput.DesignScenario.LocationScenarioID, soilGeometryName, iterationIndex);
+ const string filenameExtension = ".sti";
+ string fileName = calculationName + filenameExtension;
+ string stabilityDirectory = GetStabilityCalculationDirectory(model);
+ return Path.Combine(stabilityDirectory, fileName);
+ }
+
+ private static string DetermineCalculationFilename(string locationName, string scenarioName,
+ string soilGeometryName, int iterationIndex)
+ {
+ string calculationName;
+ if (iterationIndex <= 0)
+ {
+ calculationName = String.Format("Loc({0})_Sce({1})_Pro({2})", locationName, scenarioName,
+ soilGeometryName);
+ }
+ else
+ {
+ calculationName = String.Format("Loc({0})_Sce({1})_Pro({2})_Ite({3})", locationName, scenarioName,
+ soilGeometryName, iterationIndex);
+ }
+ return Regex.Replace(calculationName, @"[\\\/:\*\?""'<>|.]", "_");
+ }
+
+ private static string GetStabilityCalculationDirectory(MStabModelType model)
+ {
+ string calculationBaseDirectory = DamProjectData.ProjectWorkingPath;
+ const string stabilitySubDir = @"Stability\";
+ string stabilityDirectory = Path.Combine(calculationBaseDirectory, stabilitySubDir);
+ var modelSubDirectory = model.ToString();
+ if (modelSubDirectory != "")
+ stabilityDirectory = Path.Combine(stabilityDirectory, modelSubDirectory);
+ if (!Directory.Exists(stabilityDirectory))
+ Directory.CreateDirectory(stabilityDirectory);
+ return stabilityDirectory;
+ }
+ }
+}
Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/DamMacroStabilityKernelWrapper.cs
===================================================================
diff -u -r821 -r822
--- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/DamMacroStabilityKernelWrapper.cs (.../DamMacroStabilityKernelWrapper.cs) (revision 821)
+++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/DamMacroStabilityKernelWrapper.cs (.../DamMacroStabilityKernelWrapper.cs) (revision 822)
@@ -25,6 +25,7 @@
using System.IO;
using System.Xml.Linq;
using Deltares.DamEngine.Calculators.KernelWrappers.Common;
+using Deltares.DamEngine.Calculators.KernelWrappers.DamMacroStabilityCommon;
using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces;
using Deltares.DamEngine.Calculators.Properties;
using Deltares.DamEngine.Data.Design;
@@ -77,14 +78,16 @@
// string fileName = calculationName + filenameExtension;
// var stabilityProjectFilename = Path.Combine(stabilityDirectory, fileName);
- const string testFolder = @"..\..\Deltares.DamEngine.Calculators.Tests\Files\MacroStability";
- // Relative paths in ini file do not work yet in DGeoStability 16.2. This is fixed in 18.1.
- var absoluteFolder = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), testFolder));
- var stiFileName = Path.Combine(absoluteFolder, "test.sti");
+ var model = FailureMechanismeParamatersMStab.MStabParameters.Model;
+ if (model == MStabModelType.BishopUpliftVan)
+ {
+ // if current model is BishopUpliftVan then set to Bishop for proper name/path for inputfile
+ model = MStabModelType.Bishop;
+ }
var damMacroStabilityInput = new DamMacroStabilityInput()
{
DGeoStabilityExePath = Path.Combine(DamMacroStabilityFolder, DGeoStabilityExe),
- DGeoStabilityInputFileName = stiFileName,
+ DGeoStabilityInputFileName = DamMacroStabilityUtils.GetStabilityInputFileName(damKernelInput, iterationIndex, model),
FailureMechanismeParamatersMStab = FailureMechanismeParamatersMStab
};
@@ -101,9 +104,8 @@
{
// see if uplift is required
// if so, both upliftvan and bishop are to be prepared, calculated and worst case is to be determined
- var stiFileName2 = Path.Combine(absoluteFolder, "test.sti");
- damMacroStabilityInput.DGeoStabilityInputFileNameSecondModel = stiFileName2;
- // if not, only Bishop calculation
+ damMacroStabilityInput.DGeoStabilityInputFileNameSecondModel = DamMacroStabilityUtils.GetStabilityInputFileName(damKernelInput, iterationIndex, MStabModelType.UpliftVan);
+ // if not, only Bishop calculation so leave SecondModel empty.
break;
}
default:
Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityOutwards/DamMacroStabilityOutwardsKernelWrapper.cs
===================================================================
diff -u -r819 -r822
--- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityOutwards/DamMacroStabilityOutwardsKernelWrapper.cs (.../DamMacroStabilityOutwardsKernelWrapper.cs) (revision 819)
+++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityOutwards/DamMacroStabilityOutwardsKernelWrapper.cs (.../DamMacroStabilityOutwardsKernelWrapper.cs) (revision 822)
@@ -27,6 +27,7 @@
using System.Xml.Linq;
using Deltares.DamEngine.Calculators.KernelWrappers.Common;
using Deltares.DamEngine.Calculators.KernelWrappers.DamMacroStability;
+using Deltares.DamEngine.Calculators.KernelWrappers.DamMacroStabilityCommon;
using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces;
using Deltares.DamEngine.Calculators.Properties;
using Deltares.DamEngine.Data.Design;
@@ -90,7 +91,8 @@
var damMacroStabilityInput = new DamMacroStabilityInput()
{
DGeoStabilityExePath = Path.Combine(damMacroStabilityFolder, dGeoStabilityExe),
- DGeoStabilityInputFileName = GetStabilityInputFileName(damKernelInput, iterationIndex),
+ DGeoStabilityInputFileName = DamMacroStabilityUtils.GetStabilityInputFileName(damKernelInput, iterationIndex,
+ FailureMechanismeParamatersMStab.MStabParameters.Model),
FailureMechanismeParamatersMStab = FailureMechanismeParamatersMStab
};
kernelDataInput = damMacroStabilityInput;
@@ -283,54 +285,6 @@
designResult.StabilityDesignResults = stabilityDesignResults;
}
designResults.Add(designResult);
- }
-
- private string GetStabilityInputFileName(DamKernelInput damKernelInput, int iterationIndex)
- {
- // Assume 2D sti-file, then check on type being 1D
- string soilGeometryName = damKernelInput.SubSoilScenario.StiFileName;
- if (damKernelInput.SubSoilScenario.SoilProfileType == SoilProfileType.ProfileType1D)
- {
- soilGeometryName = damKernelInput.SubSoilScenario.SoilProfile1DName;
- }
-
- string calculationName = DetermineCalculationFilename(damKernelInput.DesignScenario.Location.Name,
- damKernelInput.DesignScenario.LocationScenarioID, soilGeometryName, iterationIndex);
- const string filenameExtension = ".sti";
- string fileName = calculationName + filenameExtension;
- string stabilityDirectory = GetStabilityCalculationDirectory();
- return Path.Combine(stabilityDirectory, fileName);
-
- }
-
- private string DetermineCalculationFilename(string locationName, string scenarioName,
- string soilGeometryName, int iterationIndex)
- {
- string calculationName;
- if (iterationIndex <= 0)
- {
- calculationName = String.Format("Loc({0})_Sce({1})_Pro({2})", locationName, scenarioName,
- soilGeometryName);
- }
- else
- {
- calculationName = String.Format("Loc({0})_Sce({1})_Pro({2})_Ite({3})", locationName, scenarioName,
- soilGeometryName, iterationIndex);
- }
- return Regex.Replace(calculationName, @"[\\\/:\*\?""'<>|.]", "_");
- }
-
- private string GetStabilityCalculationDirectory()
- {
- string calculationBaseDirectory = DamProjectData.ProjectWorkingPath;
- const string stabilitySubDir = @"Stability\";
- string stabilityDirectory = Path.Combine(calculationBaseDirectory, stabilitySubDir);
- var modelSubDirectory = FailureMechanismeParamatersMStab.MStabParameters.Model.ToString();
- if (modelSubDirectory != "")
- stabilityDirectory = Path.Combine(stabilityDirectory, modelSubDirectory);
- if (!Directory.Exists(stabilityDirectory))
- Directory.CreateDirectory(stabilityDirectory);
- return stabilityDirectory;
- }
+ }
}
}
Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj
===================================================================
diff -u -r819 -r822
--- dam engine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj (.../Deltares.DamEngine.Calculators.csproj) (revision 819)
+++ dam engine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj (.../Deltares.DamEngine.Calculators.csproj) (revision 822)
@@ -93,6 +93,7 @@
+