Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelper.cs =================================================================== diff -u -r5249 -r5268 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelper.cs (.../MacroStabilityCommonHelper.cs) (revision 5249) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelper.cs (.../MacroStabilityCommonHelper.cs) (revision 5268) @@ -31,10 +31,10 @@ using Deltares.DamEngine.Calculators.Properties; using Deltares.DamEngine.Data.Design; using Deltares.DamEngine.Data.General; +using Deltares.DamEngine.Data.General.PlLines; using Deltares.DamEngine.Data.General.Results; using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Geotechnics; -using Deltares.DamEngine.Data.Standard; using Deltares.DamEngine.Data.Standard.Calculation; using Deltares.DamEngine.Data.Standard.Language; using Deltares.DamEngine.Data.Standard.Logging; @@ -411,10 +411,38 @@ } /// - /// Combines the surfaceline with the SoilProfile2D. + /// Create the waternet using the 1D soil profile if available, otherwise the 2D soil profile. /// + /// + /// + /// The waternet. + public static Waternet CreateWaternet(DamKernelInput damKernelInput, PlLines plLines) + { + double penetrationLength = damKernelInput.Location.ModelParametersForPlLines.PenetrationLength; + IntrusionVerticalWaterPressureType? pressureType = damKernelInput.Location.IntrusionVerticalWaterPressure; + + if (damKernelInput.SubSoilScenario.SoilProfile2D == null) + { + return null; + } + + if (damKernelInput.SubSoilScenario.SoilProfile1D != null) + { + SurfaceLine2 surfaceLine = damKernelInput.Location.SurfaceLine; + SoilProfile1D soilProfile1D = damKernelInput.SubSoilScenario.SoilProfile2D.GetSoilProfile1D( + damKernelInput.Location.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X); + return PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile1D, surfaceLine, penetrationLength, pressureType); + } + + SoilProfile2D soilProfile2D = damKernelInput.SubSoilScenario.SoilProfile2D; + return PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile2D, penetrationLength, pressureType); + } + + /// + /// Combines the surface line with the SoilProfile2D. + /// /// The sub soil scenario. - /// The surfaceline. + /// The surface line. /// The dike embankment soil. /// Thrown when no SoilProfile2D is defined private static void CombineSoilProfile2DWithSurfaceLine(SoilGeometryProbability subSoilScenario, SurfaceLine2 surfaceLine2, @@ -482,7 +510,6 @@ subSoilScenario.SoilProfile2D = soilProfile2DNew; subSoilScenario.SoilProfile2DName = soilProfile2DNew.Name; subSoilScenario.SoilProfileType = SoilProfileType.ProfileType2D; - subSoilScenario.SoilProfile1D = null; } }