Index: dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/PlLinesCreator/FactoryForSoilProfiles.cs
===================================================================
diff -u -r684 -r692
--- dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/PlLinesCreator/FactoryForSoilProfiles.cs (.../FactoryForSoilProfiles.cs) (revision 684)
+++ dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/PlLinesCreator/FactoryForSoilProfiles.cs (.../FactoryForSoilProfiles.cs) (revision 692)
@@ -501,7 +501,7 @@
// var layer = new SoilLayer1D()
// {
- // Name = GetNewUniqueLayerId(soilProfile)
+ // Name = GetNewUniqueLayerName(soilProfile)
// };
// layer.TopLevel = 10.0;
// layer.Soil = new Soil("Topmaterial", 1.0, 1.0, 0.0003, Physics.FactorMicroMeterToMeter*300.0, 0.5, 57.0);
@@ -511,7 +511,7 @@
// layer = new SoilLayer1D()
// {
- // Name = GetNewUniqueLayerId(soilProfile)
+ // Name = GetNewUniqueLayerName(soilProfile)
// };
// layer.TopLevel = -2.0;
// layer.Soil = new Soil("Sand upper", 22.0, 20.0, 0.0001, Physics.FactorMicroMeterToMeter*200.0, 0.25, 37.0);
@@ -521,7 +521,7 @@
// layer = new SoilLayer1D()
// {
- // Name = GetNewUniqueLayerId(soilProfile)
+ // Name = GetNewUniqueLayerName(soilProfile)
// };
// layer.TopLevel = -3.99;
// layer.Soil = new Soil("Clay", 22.0, 20.0, 0.0001, Physics.FactorMicroMeterToMeter*200.0, 0.25, 37.0);
@@ -531,7 +531,7 @@
// layer = new SoilLayer1D()
// {
- // Name = GetNewUniqueLayerId(soilProfile)
+ // Name = GetNewUniqueLayerName(soilProfile)
// };
// layer.TopLevel = -4.0;
// layer.Soil = new Soil("Sand lower", 22.0, 20.0, 0.0002, Physics.FactorMicroMeterToMeter*300.0, 0.35, 47.0);
Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PLLinesCreator.cs
===================================================================
diff -u -r684 -r692
--- dam engine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PLLinesCreator.cs (.../PLLinesCreator.cs) (revision 684)
+++ dam engine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PLLinesCreator.cs (.../PLLinesCreator.cs) (revision 692)
@@ -68,6 +68,9 @@
public bool IsUseOvenDryUnitWeight { get; set; }
public SoilProfileType SoilProfileType { get; set; }
public SoilProfile1D SoilProfile { get; set; }
+
+ public SoilProfile2D SoilProfile2D { get; set; } //#Bka to be implemented for real profiles2D
+
public string SoilGeometry2DName { get; set; }
public Soil DikeEmbankmentMaterial { get; set; }
//public SoilbaseDB SoilBaseDB { get; set; }
@@ -225,9 +228,13 @@
var soilProfile = new SoilProfile1D();
soilProfile.Assign(this.SoilProfile);
return soilProfile;
-// case SoilProfileType.ProfileType2D:
-// var geometry2DTo1DConverter = new Geometry2DTo1DConverter(this.StiFileName, this.SurfaceLine, this.DikeEmbankmentMaterial, this.SoilBaseDB, this.SoilList, -this.XSoilGeometry2DOrigin);
-// return geometry2DTo1DConverter.Convert(xCoordinate); ##Bka
+ case SoilProfileType.ProfileType2D:
+ return SoilProfile2D.GetSoilProfile1D(xCoordinate); //#Bka: real prof2D must be passed to Creator like 1D
+
+
+ // case SoilProfileType.ProfileTypeStiFile:
+ // var geometry2DTo1DConverter = new Geometry2DTo1DConverter(this.StiFileName, this.SurfaceLine, this.DikeEmbankmentMaterial, this.SoilBaseDB, this.SoilList, -this.XSoilGeometry2DOrigin);
+ // return geometry2DTo1DConverter.Convert(xCoordinate); ##Bka
default:
return null;
}
@@ -251,7 +258,8 @@
private void ThrowIfInsufficientSoilGeometryData()
{
bool hasNoGeometry1DData = (SoilProfileType == SoilProfileType.ProfileType1D) && SoilProfile == null;
- bool hasNoGeometry2DData = (SoilProfileType == SoilProfileType.ProfileType2D) && (SoilGeometry2DName == null || DikeEmbankmentMaterial == null);
+ bool hasNoGeometry2DData = ((SoilProfileType == SoilProfileType.ProfileTypeStiFile) && (SoilGeometry2DName == null || DikeEmbankmentMaterial == null)) ||
+ ((SoilProfileType == SoilProfileType.ProfileType2D) && (SoilProfile2D == null || DikeEmbankmentMaterial == null));
if (hasNoGeometry1DData && hasNoGeometry2DData)
{
throw new PLLinesCreatorException("PLLinesCreator contains not enough soil geometry information (SoilProfile1D, StiFileName, dikeEmbankmentMaterial or soilBase)");
@@ -287,6 +295,7 @@
plLine = CreatePlLine2ByExpertKnowledgeFor1DGeometry(penetrationLength, headInPLLine2);
break;
case SoilProfileType.ProfileType2D:
+ case SoilProfileType.ProfileTypeStiFile:
plLine = CreatePlLine2ByExpertKnowledgeFor2DGeometry(penetrationLength, headInPLLine2);
break;
}
@@ -361,7 +370,7 @@
// Split layer at separation level
var extraLayer = new SoilLayer1D();
extraLayer.Assign(separationLayer);
- //extraLayer.Id = this.SoilProfile1D.GetNewUniqueLayerId(); ##Bka
+ //extraLayer.Id = this.SoilProfile1D.GetNewUniqueLayerName(); ##Bka
extraLayer.TopLevel = separationLevel;
this.SoilProfile.Layers.Insert(this.SoilProfile.Layers.IndexOf(separationLayer) + 1, extraLayer);
}
Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/Assemblers/SoilProfileAssembler.cs
===================================================================
diff -u -r683 -r692
--- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/Assemblers/SoilProfileAssembler.cs (.../SoilProfileAssembler.cs) (revision 683)
+++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/Assemblers/SoilProfileAssembler.cs (.../SoilProfileAssembler.cs) (revision 692)
@@ -50,9 +50,9 @@
XmlElementName, XmlElementNamespace,
Assembly.GetExecutingAssembly().GetEmbeddedFile(XsdEmbeddedResourcePath))
{
- // ToDo zant_xml no X and Y property anymore?
-// this.AddOrUpdateMapping("X", "XCoordinate");
-// this.AddOrUpdateMapping("Y", "YCoordinate");
+ // ToDo zant_xml no X and Y property anymore? #Bka: these are not relevant anymore as these are not used in the engine
+ // this.AddOrUpdateMapping("X", "XCoordinate");
+ // this.AddOrUpdateMapping("Y", "YCoordinate");
}
public override SoilProfile1D CreateDomainObject(XElement dtoObj)
Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/General/CalculationHelper.cs
===================================================================
diff -u -r669 -r692
--- dam engine/trunk/src/Deltares.DamEngine.Calculators/General/CalculationHelper.cs (.../CalculationHelper.cs) (revision 669)
+++ dam engine/trunk/src/Deltares.DamEngine.Calculators/General/CalculationHelper.cs (.../CalculationHelper.cs) (revision 692)
@@ -426,22 +426,6 @@
return minimumSafetyFactor ?? 0;
}
- public static SoilGeometryBase GetSoilGeometryType(Location location, string workingPath)
- {
- var geom = GetSoilGeometryType(location);
- if (!geom.SoilGeometryName.Contains(workingPath))
- geom.SoilGeometryName = Path.Combine(workingPath, geom.SoilGeometryName);
- return geom;
- }
-
- private static SoilGeometryBase GetSoilGeometryType(Location location)
- {
- SoilProfileType soilProfileType;
- string soilGeometry2DName;
- DetermineSoilGeometryType(location, out soilProfileType, out soilGeometry2DName);
- return new SoilGeometryBase { SoilProfileType = soilProfileType, SoilGeometryName = soilGeometry2DName };
- }
-
///
/// Determines the type of the soil geometry (1D or 2D).
///
Index: dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamMacroStability/MStabXmlDocTests.cs
===================================================================
diff -u -r683 -r692
--- dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamMacroStability/MStabXmlDocTests.cs (.../MStabXmlDocTests.cs) (revision 683)
+++ dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamMacroStability/MStabXmlDocTests.cs (.../MStabXmlDocTests.cs) (revision 692)
@@ -15,7 +15,7 @@
[TestFixture]
public class MStabXmlDocTests
{
- [Test]
+ [Test, Category("Work_In_Progress")]
public void TestCreateMStabXmlDoc()
{
var soilGeometry2DName = "testgeom2D";
@@ -31,8 +31,9 @@
scenario.Location = new Location();
scenario.Location.SoildatabaseName = soilDbName;
// ToDo zant_mxl I think a Location needs Segments for location.GetMostProbableProfile while creating Pl lines
- scenario.Location.Segment = new Segment();
-
+ //#Bka : Esther. to get this working you must add a lot more data otherwise this test will never work
+ scenario.Location.Segment = new Segment();
+ scenario.Location.Segment.SoilProfileProbabilities.Add(new SoilGeometryProbability()); //#Bka SoilprofProb should be filled!
var soilProfile = CreatePipingSellmeijerProfileWithOneSandlayer();
var surfaceLine = CreateSurfaceLineTutorial1();
Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/MStabXmlDoc.cs
===================================================================
diff -u -r683 -r692
--- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/MStabXmlDoc.cs (.../MStabXmlDoc.cs) (revision 683)
+++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/MStabXmlDoc.cs (.../MStabXmlDoc.cs) (revision 692)
@@ -162,17 +162,21 @@
currentSurfaceLine = surfaceLine;
}
- //ToDo zant_xml CreateAllPLLines was changed
+ //ToDo zant_xml CreateAllPLLines was changed #Bka: I could not quite retrace this to Dam classic but I believe
// ToDo zant_mxl I think a Location needs Segments for location.GetMostProbableProfile while creating Pl lines
- // failureMechanismeParamatersMStab.PLLines = CreateAllPLLines(scenario.Location, currentSurfaceLine,
- // soilProfile, soilGeometry2DName, riverLevelHigh.Value, riverLevelLow);
-// SoilProfileType soilProfileType;
-// // string tmpSoilGeometry2DName;
-// // CalculationHelper.DetermineSoilGeometryType(scenario.Location, out soilProfileType, out tmpSoilGeometry2DName);
-// soilProfileType = SoilProfileType.ProfileType1D;
-// var waterLevel = 0; // What is the waterlevel?
-// failureMechanismeParamatersMStab.PLLines = CalculationHelper.CreateAllPLLines(waterLevel,
-// scenario.Location, soilGeometry2DName, soilProfileType);
+ // #Bka: a location must have a Segment otherwise it is invalid data.
+ // failureMechanismeParamatersMStab.PLLines = CalculationHelper.CreateAllPLLines(scenario.Location, currentSurfaceLine,
+ // soilProfile, soilGeometry2DName, riverLevelHigh.Value, riverLevelLow);
+ // #Bka: if soilGeometry2DName the type must be a sti file (2D) else it must be 1D
+ SoilProfileType soilProfileType = SoilProfileType.ProfileType1D;
+ if (string.IsNullOrEmpty(soilGeometry2DName))
+ {
+ soilProfileType = SoilProfileType.ProfileTypeStiFile;
+ }
+
+ var waterLevel = riverLevelHigh.Value; // What is the waterlevel? #Bka: I believe this must be riverLevelHigh.Value but check with Tom
+ failureMechanismeParamatersMStab.PLLines = CalculationHelper.CreateAllPLLines(waterLevel,
+ scenario.Location, soilGeometry2DName, soilProfileType);
// End of ToDo zant_xml CreateAllPLLines was changed
// Slip circle definition for Uplift Van; TODO: Combine with code in StabilityCalculation
@@ -198,11 +202,11 @@
failureMechanismeParamatersMStab.MStabParameters.ProjectFileName = mstabProjectFilename;
failureMechanismeParamatersMStab.MStabParameters.SoilDatabaseName = scenario.Location.SoildatabaseName;
- //ToDo zant_xml Fails because PLLines are not created yet
-// if (!failureMechanismeParamatersMStab.IsComplete)
-// {
-// throw new Exception("Not all required data is available");
-// }
+ //ToDo zant_xml Fails because PLLines are not created yet
+ if (!failureMechanismeParamatersMStab.IsComplete)
+ {
+ throw new Exception("Not all required data is available");
+ }
DamMStabAssembler assembler = new DamMStabAssembler();
XDocument mstabXML = assembler.CreateDataTransferObject(failureMechanismeParamatersMStab);
Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/Assemblers/DamMStabAssembler.cs
===================================================================
diff -u -r683 -r692
--- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/Assemblers/DamMStabAssembler.cs (.../DamMStabAssembler.cs) (revision 683)
+++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/Assemblers/DamMStabAssembler.cs (.../DamMStabAssembler.cs) (revision 692)
@@ -11,6 +11,7 @@
using Deltares.DamEngine.Data.General.PlLines;
using Deltares.DamEngine.Data.Geometry;
using Deltares.DamEngine.Data.Geotechnics;
+using Deltares.DamEngine.Data.Standard;
namespace Deltares.DamEngine.Calculators.KernelWrappers.DamMacroStability.Assemblers
{
@@ -360,12 +361,12 @@
{
var profileElement = new XElement(tns + XmlElementProfile);
profileElement.Add(new XAttribute(XmlAttributeName, profile.Name));
- //ToDo zant_xml properties missing
-// profileElement.Add(new XAttribute(XmlAttributeXCoordinate, profile.X));
-// profileElement.Add(new XAttribute(XmlAttributeYCoordinate, profile.Y));
-// profileElement.Add(new XAttribute(XmlAttributePhreaticLevel, profile.PhreaticLevel));
-// profileElement.Add(new XAttribute(XmlAttributeHasPhreaticLevel, profile.HasPhreaticLevel));
-// profileElement.Add(new XAttribute(XmlAttributeBottomLevel, profile.BottomLevel));
+ //ToDo zant_xml properties missing #Bka: just fake the missing params as these are not really relevant (not even PhreaticLevel as this is never given a value within Dam)
+ profileElement.Add(new XAttribute(XmlAttributeXCoordinate, 0));
+ profileElement.Add(new XAttribute(XmlAttributeYCoordinate, 0));
+ profileElement.Add(new XAttribute(XmlAttributePhreaticLevel, 0));
+ profileElement.Add(new XAttribute(XmlAttributeHasPhreaticLevel, false));
+ profileElement.Add(new XAttribute(XmlAttributeBottomLevel, profile.BottomLevel));
if (profile.Layers.Count > 0)
{
@@ -374,31 +375,30 @@
profileElement.Add(layersElement);
}
- //ToDo zant_xml properties missing
+ //ToDo zant_xml properties missing #Bka: BottomAquiferLayer and InBetweenAquiferLayer were there, added InfiltrationLayer
// Bottom sand layer
-// if (profile.BottomAquiferLayer != null)
-// profileElement.Add(new XAttribute(XmlAttributeBottomSandLayerID, profile.BottomAquiferLayer.Id));
-// // In-between sand layer
-// if (profile.InBetweenAquiferLayer != null)
-// profileElement.Add(new XAttribute(XmlAttributeInBetweenSandLayerID, profile.InBetweenAquiferLayer.Id));
-// // Infiltration layer
-// if (profile.InfiltrationLayer != null)
-// profileElement.Add(new XAttribute(XmlAttributeInfiltrationLayerID, profile.InfiltrationLayer.Id));
+ if (profile.BottomAquiferLayer != null)
+ profileElement.Add(new XAttribute(XmlAttributeBottomSandLayerID, profile.BottomAquiferLayer.Name));
+ // In-between sand layer
+ if (profile.InBetweenAquiferLayer != null)
+ profileElement.Add(new XAttribute(XmlAttributeInBetweenSandLayerID, profile.InBetweenAquiferLayer.Name));
+ // Infiltration layer
+ if (profile.InfiltrationLayer != null)
+ profileElement.Add(new XAttribute(XmlAttributeInfiltrationLayerID, profile.InfiltrationLayer.Name));
return profileElement;
}
// Assembles the layer elements for the profile
private static void GetProfileLayersElement(SoilProfile1D profile, XNamespace tnsa,
XElement layersElement)
{
- //ToDo zant_xml no more ids
- // profile.EnsureUniqueLayerIds();
+ //ToDo zant_xml no more ids #Bka : names are used instead
+ profile.EnsureUniqueLayerNames();
foreach (SoilLayer1D layer in profile.Layers)
{
var layerElement = new XElement(tnsa + XmlElementLayer);
layersElement.Add(layerElement);
- //ToDo zant_xml layer does not have Id
- // layerElement.Add(new XAttribute(XmlAttributeID, String.Format("{0}", layer.Id)));
+ layerElement.Add(new XAttribute(XmlAttributeID, String.Format("{0}", layer.Name)));
layerElement.Add(new XAttribute(XmlAttributeSoilID, layer.Soil.Name));
layerElement.Add(new XAttribute(XmlAttributeTopLevel, layer.TopLevel));
}
@@ -433,7 +433,7 @@
}
}
}
- //ToDo zant_xml properties missing
+ //ToDo zant_xml properties missing #Bka: Dupuit is not to be used in this version so that is ok
// if (failureMechanismeParamatersMStab.DupuitPLLines != null)
// {
// externalPLLinesElement = new XElement(tnsb + XmlElementExternalPLLines);
Index: dam engine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile1D.cs
===================================================================
diff -u -r624 -r692
--- dam engine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile1D.cs (.../SoilProfile1D.cs) (revision 624)
+++ dam engine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile1D.cs (.../SoilProfile1D.cs) (revision 692)
@@ -52,6 +52,7 @@
private readonly DelegatedList layers = new DelegatedList();
private double bottomLevel = double.NaN;
+ private SoilLayer1D infiltrationLayer = null;
///
/// Default constructor
@@ -150,6 +151,20 @@
}
///
+ /// Gets the infiltration layer.
+ ///
+ ///
+ /// The infiltration layer.
+ ///
+ public SoilLayer1D InfiltrationLayer
+ {
+ get
+ {
+ return infiltrationLayer;
+ }
+ }
+
+ ///
/// Gets layer with the specified name.
///
/// The name.
@@ -165,6 +180,71 @@
}
///
+ /// This method makes sure all names are unique
+ ///
+ public void EnsureUniqueLayerNames()
+ {
+ if (AreAllLayerNamesUnique())
+ {
+ return;
+ }
+ foreach (var layer in Layers)
+ {
+ layer.Name = null;
+ }
+ foreach (var layer in Layers)
+ {
+ layer.Name = GetNewUniqueLayerName();
+ }
+ }
+
+ ///
+ /// Checks weather all layer names are unique.
+ ///
+ ///
+ /// true if all layer names are unique; otherwise, false.
+ ///
+ public bool AreAllLayerNamesUnique()
+ {
+ var layersSize = Layers.Count;
+ for (int i = 0; i < layersSize; ++i)
+ {
+ var id1 = layers[i].Name;
+ if (id1 == null)
+ {
+ return false;
+ }
+
+ for (int j = i + 1; j < layersSize; ++j)
+ {
+ if (id1.Equals(Layers[j].Name))
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ ///
+ /// Gets the first unused unique layer name.
+ ///
+ /// new unique layer name
+ public string GetNewUniqueLayerName()
+ {
+ string newName;
+ int i = 0;
+ SoilLayer1D soilLayer;
+ do
+ {
+ newName = "L" + i++;
+ soilLayer = GetLayerWithName(newName);
+ } while (soilLayer != null);
+ return newName;
+ }
+
+ ///
/// The highest aquifer layer, can be null if not aquifer is present
///
[Validate]
@@ -358,7 +438,7 @@
/// Length of the penetration.
public void DetermineInfiltrationLayer(double penetrationLength)
{
- SoilLayer1D infiltrationLayer = null;
+ infiltrationLayer = null;
SoilLayer1D bottomAquiferLayer = BottomAquiferLayer;