Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/SoilProfileCreator.cs =================================================================== diff -u -r177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff -rfed3ead7401b6f3317ec3a5be54ec7bda38552cc --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/SoilProfileCreator.cs (.../SoilProfileCreator.cs) (revision 177ec6713fcf4dbdbc5fd2a542fb7bfa6554e1ff) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/SoilProfileCreator.cs (.../SoilProfileCreator.cs) (revision fed3ead7401b6f3317ec3a5be54ec7bda38552cc) @@ -24,6 +24,8 @@ using System.Linq; using Deltares.WTIStability.Data.Geo; using Ringtoets.MacroStabilityInwards.Primitives.MacroStabilityInwardsSoilUnderSurfaceLine; +using Point2D = Core.Common.Base.Geometry.Point2D; +using WTIStabilityPoint2D = Deltares.WTIStability.Data.Geo.Point2D; namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Creators { @@ -38,11 +40,17 @@ /// Creates a with the given /// which can be used in the . /// + /// The soil profile to create the for. /// The data to use in the . /// A new with the . - /// Thrown when is null. - public static SoilProfile2D Create(IDictionary layersWithSoils) + /// Thrown when any parameter is null. + public static SoilProfile2D Create(MacroStabilityInwardsSoilProfileUnderSurfaceLine soilProfile, + IDictionary layersWithSoils) { + if (soilProfile == null) + { + throw new ArgumentNullException(nameof(soilProfile)); + } if (layersWithSoils == null) { throw new ArgumentNullException(nameof(layersWithSoils)); @@ -51,6 +59,7 @@ geometryData = new GeometryData(); var profile = new SoilProfile2D(); + profile.PreconsolidationStresses.AddRange(CreatePreconsolidationStresses(soilProfile)); foreach (KeyValuePair layerWithSoil in layersWithSoils) { @@ -71,6 +80,16 @@ return profile; } + private static IEnumerable CreatePreconsolidationStresses(MacroStabilityInwardsSoilProfileUnderSurfaceLine soilProfile) + { + return soilProfile.PreconsolidationStresses.Select(preconsolidationStress => new PreConsolidationStress + { + StressValue = preconsolidationStress.PreconsolidationStressDesignVariable, + X = preconsolidationStress.XCoordinate, + Z = preconsolidationStress.ZCoordinate + }).ToArray(); + } + private static GeometrySurface CreateGeometrySurface(MacroStabilityInwardsSoilLayerUnderSurfaceLine layer) { var outerLoop = new GeometryLoop(); @@ -82,7 +101,7 @@ geometryData.Loops.Add(outerLoop); var innerloops = new List(); - foreach (Core.Common.Base.Geometry.Point2D[] layerHole in layer.Holes) + foreach (Point2D[] layerHole in layer.Holes) { GeometryCurve[] holeCurves = ToCurveList(layerHole); geometryData.Curves.AddRange(holeCurves); @@ -109,18 +128,18 @@ return loop; } - private static GeometryCurve[] ToCurveList(Core.Common.Base.Geometry.Point2D[] points) + private static GeometryCurve[] ToCurveList(Point2D[] points) { - var geometryPoints = (List)geometryData.Points; + var geometryPoints = (List) geometryData.Points; var curves = new List(); - var firstPoint = new Point2D(points[0].X, points[0].Y); - Point2D lastPoint = null; + var firstPoint = new WTIStabilityPoint2D(points[0].X, points[0].Y); + WTIStabilityPoint2D lastPoint = null; for (var i = 0; i < points.Length - 1; i++) { - Point2D headPoint; + Deltares.WTIStability.Data.Geo.Point2D headPoint; if (i == 0) { @@ -132,14 +151,14 @@ headPoint = lastPoint; } - var endPoint = new Point2D(points[i + 1].X, points[i + 1].Y); + var endPoint = new WTIStabilityPoint2D(points[i + 1].X, points[i + 1].Y); geometryPoints.Add(endPoint); curves.Add(new GeometryCurve { HeadPoint = headPoint, - EndPoint = endPoint, + EndPoint = endPoint }); lastPoint = endPoint;