Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilProfileExtensions.cs =================================================================== diff -u -r06abcaadc2936c0bf3fde73916c051f37f698505 -r04e39e2be6e56f40de8ca5ade95a2e9c0c736c85 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilProfileExtensions.cs (.../PipingSoilProfileExtensions.cs) (revision 06abcaadc2936c0bf3fde73916c051f37f698505) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilProfileExtensions.cs (.../PipingSoilProfileExtensions.cs) (revision 04e39e2be6e56f40de8ca5ade95a2e9c0c736c85) @@ -38,15 +38,45 @@ /// is less than . public static double GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(this PipingSoilProfile soilProfile, double level) { - var aquiferLayers = soilProfile.GetConsecutiveAquiferLayersBelowLevel(level).ToArray(); + return TotalThicknessOfConsecutiveLayersBelowLevel( + soilProfile, + level, + soilProfile.GetConsecutiveAquiferLayersBelowLevel(level).ToArray()); + } - if (aquiferLayers.Length == 0) + /// + /// Retrieves the thickness of the consecutive coverage layers (if any) which are (partly) under a certain . + /// Only the thickness of the part of the coverage layer under the level is determined. + /// + /// The soil profile containing to consider. + /// The level under which the coverage layers are sought. + /// The thickness of the part of the consecutive coverage layer(s) (partly) under the . + /// is less than . + public static double GetConsecutiveCoverageLayerThicknessBelowLevel(this PipingSoilProfile soilProfile, double level) + { + return TotalThicknessOfConsecutiveLayersBelowLevel( + soilProfile, + level, + soilProfile.GetConsecutiveCoverageLayersBelowLevel(level).ToArray()); + } + + /// + /// Calculates the thickness of the + /// + /// The containing the . + /// The level under which to calculate the total thickness. + /// Collection of consecutvie , ordered by + /// . + /// + private static double TotalThicknessOfConsecutiveLayersBelowLevel(PipingSoilProfile soilProfile, double level, PipingSoilLayer[] coverageLayers) + { + if (coverageLayers.Length == 0) { return double.NaN; } - var bottomLayer = aquiferLayers.Last(); - var topLayer = aquiferLayers.First(); + var bottomLayer = coverageLayers.Last(); + var topLayer = coverageLayers.First(); return Math.Min(topLayer.Top, level) - (bottomLayer.Top - soilProfile.GetLayerThickness(bottomLayer)); }