Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingCalculationConfigurationHelper.cs =================================================================== diff -u -r8832cfacbfb0a999d9dd5ddcb93fd81bdb2fb09f -rcda9bb0707f49cfb8e685d3ec04da01240c73f26 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingCalculationConfigurationHelper.cs (.../PipingCalculationConfigurationHelper.cs) (revision 8832cfacbfb0a999d9dd5ddcb93fd81bdb2fb09f) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingCalculationConfigurationHelper.cs (.../PipingCalculationConfigurationHelper.cs) (revision cda9bb0707f49cfb8e685d3ec04da01240c73f26) @@ -75,46 +75,49 @@ } /// - /// Gets the stochastic soil profiles matching the input of a calculation. + /// Gets the stochastic soil models matching the input of a calculation. /// /// The surface line used to match a . - /// The available soil models. - /// The (sub)set of soil profiles from + /// The available stochastic soil models. + /// The (sub)set of stochastic soil models from /// or empty if no matching instances can be found /// or when there is not enough information to associate soil profiles to the calculation. - public static IEnumerable GetStochasticSoilProfilesForSurfaceLine(RingtoetsPipingSurfaceLine surfaceLine, IEnumerable availableSoilModels) + public static IEnumerable GetStochasticSoilModelsForSurfaceLine(RingtoetsPipingSurfaceLine surfaceLine, IEnumerable availableSoilModels) { if (surfaceLine == null) { - return Enumerable.Empty(); + return Enumerable.Empty(); } Segment2D[] surfaceLineSegments = Math2D.ConvertLinePointsToLineSegments(surfaceLine.Points.Select(p => new Point2D(p.X, p.Y))).ToArray(); - var soilProfileObjectsForCalculation = new List(); + var soilModelObjectsForCalculation = new List(); foreach (StochasticSoilModel stochasticSoilModel in availableSoilModels.Where(sm => sm.StochasticSoilProfiles.Any())) { if (DoesSoilModelGeometryIntersectWithSurfaceLineGeometry(stochasticSoilModel, surfaceLineSegments)) { - soilProfileObjectsForCalculation.AddRange(stochasticSoilModel.StochasticSoilProfiles); + soilModelObjectsForCalculation.Add(stochasticSoilModel); } } - return soilProfileObjectsForCalculation; + return soilModelObjectsForCalculation; } private static IPipingCalculationItem CreateCalculationGroup(RingtoetsPipingSurfaceLine surfaceLine, IEnumerable soilModels, GeneralPipingInput generalInput, SemiProbabilisticPipingInput semiProbabilisticInput) { var pipingCalculationGroup = new PipingCalculationGroup(surfaceLine.Name, true); - - foreach (var profile in GetStochasticSoilProfilesForSurfaceLine(surfaceLine, soilModels)) + var stochasticSoilModels = GetStochasticSoilModelsForSurfaceLine(surfaceLine, soilModels); + foreach (var stochasticSoilModel in stochasticSoilModels) { - pipingCalculationGroup.Children.Add(CreatePipingCalculation(surfaceLine, profile, pipingCalculationGroup.Children, generalInput, semiProbabilisticInput)); + foreach (var soilProfile in stochasticSoilModel.StochasticSoilProfiles) + { + pipingCalculationGroup.Children.Add(CreatePipingCalculation(surfaceLine, stochasticSoilModel, soilProfile, pipingCalculationGroup.Children, generalInput, semiProbabilisticInput)); + } } return pipingCalculationGroup; } - private static IPipingCalculationItem CreatePipingCalculation(RingtoetsPipingSurfaceLine surfaceLine, StochasticSoilProfile stochasticSoilProfile, IEnumerable calculations, GeneralPipingInput generalInput, SemiProbabilisticPipingInput semiProbabilisticInput) + private static IPipingCalculationItem CreatePipingCalculation(RingtoetsPipingSurfaceLine surfaceLine, StochasticSoilModel stochasticSoilModel, StochasticSoilProfile stochasticSoilProfile, IEnumerable calculations, GeneralPipingInput generalInput, SemiProbabilisticPipingInput semiProbabilisticInput) { var nameBase = string.Format("{0} {1}", surfaceLine.Name, stochasticSoilProfile); var name = NamingHelper.GetUniqueName(calculations, nameBase, c => c.Name); @@ -125,6 +128,7 @@ InputParameters = { SurfaceLine = surfaceLine, + StochasticSoilModel = stochasticSoilModel, StochasticSoilProfile = stochasticSoilProfile } };