// Copyright (C) Stichting Deltares 2017. All rights reserved. // // This file is part of Ringtoets. // // Ringtoets is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // // All names, logos, and references to "Deltares" are registered trademarks of // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. using System; using Core.Common.IO.Readers; using Core.Common.Utils.Builders; using Ringtoets.Common.IO.Exceptions; using Ringtoets.Common.IO.Properties; using Ringtoets.Common.IO.SoilProfile.Schema; namespace Ringtoets.Common.IO.SoilProfile { /// /// Class responsible for reading layer properties from a database reader. /// internal class LayerProperties { /// /// Creates a new instance of which contains properties /// that are required to create a complete soil layer. /// /// The to obtain the required /// layer property values from. /// The profile name used in generating exceptions messages /// if reading property values fails. /// Thrown when any of the input parameters is /// null. /// Thrown when the values in the database /// cannot be casted to the expected column types. internal LayerProperties(IRowBasedDatabaseReader reader, string profileName) { if (reader == null) { throw new ArgumentNullException(nameof(reader)); } if (profileName == null) { throw new ArgumentNullException(nameof(profileName)); } string readColumn = SoilProfileTableDefinitions.IsAquifer; try { IsAquifer = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.MaterialName; MaterialName = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.Color; Color = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.BelowPhreaticLevelDistribution; BelowPhreaticLevelDistribution = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.BelowPhreaticLevelShift; BelowPhreaticLevelShift = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.BelowPhreaticLevelMean; BelowPhreaticLevelMean = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.BelowPhreaticLevelDeviation; BelowPhreaticLevelDeviation = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.DiameterD70Distribution; DiameterD70Distribution = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.DiameterD70Shift; DiameterD70Shift = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.DiameterD70Mean; DiameterD70Mean = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.DiameterD70CoefficientOfVariation; DiameterD70CoefficientOfVariation = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.PermeabilityDistribution; PermeabilityDistribution = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.PermeabilityShift; PermeabilityShift = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.PermeabilityMean; PermeabilityMean = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.PermeabilityCoefficientOfVariation; PermeabilityCoefficientOfVariation = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.UsePop; UsePop = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.ShearStrengthModel; ShearStrengthModel = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.AbovePhreaticLevelDistribution; AbovePhreaticLevelDistribution = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.AbovePhreaticLevelMean; AbovePhreaticLevelMean = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.AbovePhreaticLevelCoefficientOfVariation; AbovePhreaticLevelCoefficientOfVariation = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.AbovePhreaticLevelShift; AbovePhreaticLevelShift = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.CohesionDistribution; CohesionDistribution = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.CohesionMean; CohesionMean = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.CohesionCoefficientOfVariation; CohesionCoefficientOfVariation = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.CohesionShift; CohesionShift = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.FrictionAngleDistribution; FrictionAngleDistribution = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.FrictionAngleMean; FrictionAngleMean = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.FrictionAngleCoefficientOfVariation; FrictionAngleCoefficientOfVariation = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.FrictionAngleShift; FrictionAngleShift = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.ShearStrengthRatioDistribution; ShearStrengthRatioDistribution = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.ShearStrengthRatioMean; ShearStrengthRatioMean = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.ShearStrengthRatioCoefficientOfVariation; ShearStrengthRatioCoefficientOfVariation = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.ShearStrengthRatioShift; ShearStrengthRatioShift = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.StrengthIncreaseExponentDistribution; StrengthIncreaseExponentDistribution = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.StrengthIncreaseExponentMean; StrengthIncreaseExponentMean = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.StrengthIncreaseExponentCoefficientOfVariation; StrengthIncreaseExponentCoefficientOfVariation = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.StrengthIncreaseExponentShift; StrengthIncreaseExponentShift = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.PopDistribution; PopDistribution = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.PopMean; PopMean = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.PopCoefficientOfVariation; PopCoefficientOfVariation = reader.ReadOrDefault(readColumn); readColumn = SoilProfileTableDefinitions.PopShift; PopShift = reader.ReadOrDefault(readColumn); } catch (InvalidCastException e) { string message = new FileReaderErrorMessageBuilder(reader.Path) .WithSubject(string.Format(Resources.SoilProfileReader_SoilProfileName_0_, profileName)) .Build(string.Format(Resources.SoilProfileReader_Profile_has_invalid_value_on_Column_0_, readColumn)); throw new SoilProfileReadException(message, profileName, e); } } /// /// Gets a value representing whether the layer is an aquifer. /// public double? IsAquifer { get; } /// /// Gets the name of the material that was assigned to the layer. /// public string MaterialName { get; } /// /// Gets the value representing the color that was used to represent the layer. /// public double? Color { get; } /// /// Gets the distribution for the volumic weight of the layer below the /// phreatic level. /// [kN/m³] /// public long? BelowPhreaticLevelDistribution { get; } /// /// Gets the shift of the distribution for the volumic weight of the layer /// below the phreatic level. /// [kN/m³] /// public double? BelowPhreaticLevelShift { get; } /// /// Gets the mean of the distribution for the volumic weight of the layer /// below the phreatic level. /// [kN/m³] /// public double? BelowPhreaticLevelMean { get; } /// /// Gets the deviation of the distribution for the volumic weight of the layer below the phreatic level. /// [kN/m³] /// public double? BelowPhreaticLevelDeviation { get; } /// /// Gets the distribution for the mean diameter of small scale tests applied to different kinds of sand, on which the /// formula of Sellmeijer has been fit. /// [m] /// public long? DiameterD70Distribution { get; } /// /// Gets the shift of the distribution for the mean diameter of small scale tests applied to different kinds of sand, /// on which the formula of Sellmeijer has been fit. /// [m] /// public double? DiameterD70Shift { get; } /// /// Gets the mean of the distribution for the mean diameter of small scale tests applied to different kinds of sand, /// on which the formula of Sellmeijer has been fit. /// [m] /// public double? DiameterD70Mean { get; } /// /// Gets the coefficient of variation of the distribution for the mean diameter of small scale tests applied to different kinds of sand, /// on which the formula of Sellmeijer has been fit. /// [m] /// public double? DiameterD70CoefficientOfVariation { get; } /// /// Gets the distribution for the Darcy-speed with which water flows through the aquifer layer. /// [m/s] /// public long? PermeabilityDistribution { get; } /// /// Gets the shift of the distribution for the Darcy-speed with which water flows through the aquifer layer. /// [m/s] /// public double? PermeabilityShift { get; } /// /// Gets the mean of the distribution for the Darcy-speed with which water flows through the aquifer layer. /// [m/s] /// public double? PermeabilityMean { get; } /// /// Gets the coefficient of variation of the distribution for the Darcy-speed with which water flows through the aquifer layer. /// [m/s] /// public double? PermeabilityCoefficientOfVariation { get; } /// /// Gets the value indicating whether to use POP for the layer. /// public double? UsePop { get; } /// /// Gets the shear strength model to use for the layer. /// public double? ShearStrengthModel { get; } /// /// Gets the distribution for the volumic weight of the layer above the phreatic level. /// [kN/m³] /// public long? AbovePhreaticLevelDistribution { get; } /// /// Gets the mean of the distribution for the volumic weight of the layer above the phreatic level. /// [kN/m³] /// public double? AbovePhreaticLevelMean { get; } /// /// Gets the deviation of the distribution for the volumic weight of the layer above the phreatic level. /// [kN/m³] /// public double? AbovePhreaticLevelCoefficientOfVariation { get; } /// /// Gets the shift of the distribution for the volumic weight of the layer above the phreatic level. /// [kN/m³] /// public double? AbovePhreaticLevelShift { get; } /// /// Gets the distribution for the mean of the distribution for the cohesion. /// [kN/m³] /// public long? CohesionDistribution { get; } /// /// Gets the mean of the distribution for the cohesion. /// [kN/m³] /// public double? CohesionMean { get; } /// /// Gets the deviation of the distribution for the cohesion. /// [kN/m³] /// public double? CohesionCoefficientOfVariation { get; } /// /// Gets the shift of the distribution for the cohesion. /// [kN/m³] /// public double? CohesionShift { get; } /// /// Gets the distribution for the friction angle. /// [°] /// public long? FrictionAngleDistribution { get; } /// /// Gets the mean of the distribution for the friction angle /// [°] /// public double? FrictionAngleMean { get; } /// /// Gets the deviation of the distribution for the friction angle. /// [°] /// public double? FrictionAngleCoefficientOfVariation { get; } /// /// Gets the shift of the distribution for the friction angle. /// [°] /// public double? FrictionAngleShift { get; } /// /// Gets the distribution for the ratio of shear strength S /// [-] /// public long? ShearStrengthRatioDistribution { get; } /// /// Gets the mean of the distribution for the ratio of shear strength S /// [-] /// public double? ShearStrengthRatioMean { get; } /// /// Gets the deviation of the distribution for the ratio of shear strength S. /// [-] /// public double? ShearStrengthRatioCoefficientOfVariation { get; } /// /// Gets the shift of the distribution for the ratio of shear strength S. /// [-] /// public double? ShearStrengthRatioShift { get; } /// /// Gets the distribution for the strength increase exponent (m). /// [-] /// public long? StrengthIncreaseExponentDistribution { get; } /// /// Gets the mean of the distribution for the strength increase exponent (m). /// [-] /// public double? StrengthIncreaseExponentMean { get; } /// /// Gets the deviation of the distribution for the strength increase exponent (m). /// [-] /// public double? StrengthIncreaseExponentCoefficientOfVariation { get; } /// /// Gets the shift of the distribution for the strength increase exponent (m). /// [-] /// public double? StrengthIncreaseExponentShift { get; } /// /// Gets the distribution for the POP. /// [kN/m²] /// public long? PopDistribution { get; } /// /// Gets mean of the distribution for the POP. /// [kN/m²] /// public double? PopMean { get; } /// /// Gets the deviation of the distribution for the POP. /// [kN/m²] /// public double? PopCoefficientOfVariation { get; } /// /// Gets the shift of the distribution for the POP. /// [kN/m²] /// public double? PopShift { get; } } }