Ejemplo n.º 1
0
        /// <summary>
        /// Converts <see cref="MacroStabilityInwardsSoilLayer2D"/> objects into <see cref="SoilLayer"/> objects.
        /// </summary>
        /// <param name="layers">The layers to convert.</param>
        /// <returns>The converted <see cref="SoilLayer"/>.</returns>
        /// <exception cref="InvalidEnumArgumentException">Thrown when
        /// <see cref="MacroStabilityInwardsSoilLayerData.ShearStrengthModel"/>
        /// is an invalid value.</exception>
        /// <exception cref="NotSupportedException">Thrown when
        /// <see cref="MacroStabilityInwardsSoilLayerData.ShearStrengthModel"/>
        /// is a valid value, but unsupported.</exception>
        private static IEnumerable <SoilLayer> ConvertLayers(IEnumerable <MacroStabilityInwardsSoilLayer2D> layers)
        {
            return(layers.Select(l =>
            {
                MacroStabilityInwardsSoilLayerData data = l.Data;

                return new SoilLayer(RingToPoints(l.OuterRing),
                                     new SoilLayer.ConstructionProperties
                {
                    MaterialName = SoilLayerDataHelper.GetValidName(data.MaterialName),
                    UsePop = data.UsePop,
                    IsAquifer = data.IsAquifer,
                    ShearStrengthModel = ConvertShearStrengthModel(data.ShearStrengthModel),
                    AbovePhreaticLevel = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetAbovePhreaticLevel(data).GetDesignValue(),
                    BelowPhreaticLevel = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetBelowPhreaticLevel(data).GetDesignValue(),
                    Cohesion = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetCohesion(data).GetDesignValue(),
                    FrictionAngle = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetFrictionAngle(data).GetDesignValue(),
                    ShearStrengthRatio = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetShearStrengthRatio(data).GetDesignValue(),
                    StrengthIncreaseExponent = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetStrengthIncreaseExponent(data).GetDesignValue(),
                    Pop = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPop(data).GetDesignValue(),
                    Dilatancy = 0.0,
                    WaterPressureInterpolationModel = WaterPressureInterpolationModel.Automatic
                },
                                     ConvertLayers(l.NestedLayers));
            }).ToArray());
        }
        private static void AssertYieldStressStatePoints(IEnumerable <MacroStabilityInwardsSoilLayer2D> layers, IEnumerable <IMacroStabilityInwardsPreconsolidationStress> preconsolidationStresses,
                                                         IEnumerable <PersistableStatePoint> yieldStressStatePoints)
        {
            Assert.AreEqual(preconsolidationStresses.Count(), yieldStressStatePoints.Count());

            for (var j = 0; j < preconsolidationStresses.Count(); j++)
            {
                IMacroStabilityInwardsPreconsolidationStress preconsolidationStress = preconsolidationStresses.ElementAt(j);

                MacroStabilityInwardsSoilLayer2D layerWithPreconsolidationStress = layers.Single(l => AdvancedMath2D.PointInPolygon(
                                                                                                     preconsolidationStress.Location,
                                                                                                     l.OuterRing.Points,
                                                                                                     l.NestedLayers.Select(nl => nl.OuterRing.Points)));
                PersistableStatePoint yieldStressStatePoint = yieldStressStatePoints.ElementAt(j);

                Assert.IsNotNull(yieldStressStatePoint.Id);
                Assert.AreEqual($"Grensspanning - {layerWithPreconsolidationStress.Data.MaterialName}", yieldStressStatePoint.Label);
                Assert.IsNotNull(yieldStressStatePoint.LayerId);
                Assert.IsFalse(yieldStressStatePoint.IsProbabilistic);

                Assert.AreEqual(preconsolidationStress.Location.X, yieldStressStatePoint.Point.X);
                Assert.AreEqual(preconsolidationStress.Location.Y, yieldStressStatePoint.Point.Z);

                Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPreconsolidationStress(preconsolidationStress).GetDesignValue(), yieldStressStatePoint.Stress.YieldStress);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Asserts whether <paramref name="actual"/> corresponds to <paramref name="original"/>.
        /// </summary>
        /// <param name="original">The original <see cref="MacroStabilityInwardsSoilLayer2D"/> array.</param>
        /// <param name="actual">The actual <see cref="SoilLayer"/> array.</param>
        /// <exception cref="AssertionException">Thrown when <paramref name="original"/>
        /// does not correspond to <paramref name="original"/>.</exception>
        /// <exception cref="InvalidEnumArgumentException">Thrown when <paramref name="original"/>
        /// contains an item with an invalid value of the enum <see cref="MacroStabilityInwardsShearStrengthModel"/>.</exception>
        /// <exception cref="NotSupportedException">Thrown when <paramref name="original"/>
        /// contains an item with an unsupported value of <see cref="MacroStabilityInwardsShearStrengthModel"/>.</exception>
        private static void AssertLayers(MacroStabilityInwardsSoilLayer2D[] original, SoilLayer[] actual)
        {
            Assert.AreEqual(original.Length, actual.Length);

            for (var i = 0; i < original.Length; i++)
            {
                CollectionAssert.AreEqual(original[i].OuterRing.Points, actual[i].OuterRing);

                AssertLayers(original[i].NestedLayers.ToArray(), actual[i].NestedLayers.ToArray());

                MacroStabilityInwardsSoilLayerData expectedData = original[i].Data;
                Assert.AreEqual(expectedData.MaterialName, actual[i].MaterialName);
                Assert.AreEqual(expectedData.UsePop, actual[i].UsePop);
                Assert.AreEqual(expectedData.IsAquifer, actual[i].IsAquifer);
                Assert.AreEqual(0.0, actual[i].Dilatancy);
                Assert.AreEqual(WaterPressureInterpolationModel.Automatic, actual[i].WaterPressureInterpolationModel);
                Assert.AreEqual(ConvertShearStrengthModel(expectedData.ShearStrengthModel), actual[i].ShearStrengthModel);

                Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetAbovePhreaticLevel(expectedData).GetDesignValue(), actual[i].AbovePhreaticLevel);
                Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetBelowPhreaticLevel(expectedData).GetDesignValue(), actual[i].BelowPhreaticLevel);
                Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetCohesion(expectedData).GetDesignValue(), actual[i].Cohesion);
                Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetFrictionAngle(expectedData).GetDesignValue(), actual[i].FrictionAngle);
                Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetStrengthIncreaseExponent(expectedData).GetDesignValue(), actual[i].StrengthIncreaseExponent);
                Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetShearStrengthRatio(expectedData).GetDesignValue(), actual[i].ShearStrengthRatio);
                Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPop(expectedData).GetDesignValue(), actual[i].Pop);
            }
        }
        private static void AssertPopStatePoints(IEnumerable <MacroStabilityInwardsSoilLayer2D> layers, IEnumerable <PersistableStatePoint> popStatePoints)
        {
            IEnumerable <MacroStabilityInwardsSoilLayer2D> layersWithPop = layers.Where(l => l.Data.UsePop &&
                                                                                        l.Data.Pop.Mean != RoundedDouble.NaN &&
                                                                                        l.Data.Pop.CoefficientOfVariation != RoundedDouble.NaN);

            Assert.AreEqual(layersWithPop.Count(), popStatePoints.Count());

            for (var j = 0; j < layersWithPop.Count(); j++)
            {
                MacroStabilityInwardsSoilLayer2D layerWithPop = layersWithPop.ElementAt(j);
                PersistableStatePoint            statePoint   = popStatePoints.ElementAt(j);

                Assert.IsNotNull(statePoint.Id);
                Assert.AreEqual($"POP - {layerWithPop.Data.MaterialName}", statePoint.Label);
                Assert.IsNotNull(statePoint.LayerId);
                Assert.IsTrue(statePoint.IsProbabilistic);

                Point2D interiorPoint = AdvancedMath2D.GetPolygonInteriorPoint(layerWithPop.OuterRing.Points, layerWithPop.NestedLayers.Select(nl => nl.OuterRing.Points));
                Assert.AreEqual(interiorPoint.X, statePoint.Point.X);
                Assert.AreEqual(interiorPoint.Y, statePoint.Point.Z);

                Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPop(layerWithPop.Data).GetDesignValue(), statePoint.Stress.Pop);
                AssertStochasticParameter(layerWithPop.Data.Pop, statePoint.Stress.PopStochasticParameter);
            }
        }
Ejemplo n.º 5
0
 private static IEnumerable <PreconsolidationStress> ConvertPreconsolidationStresses(
     IEnumerable <IMacroStabilityInwardsPreconsolidationStress> preconsolidationStresses)
 {
     return(preconsolidationStresses.Select(ps => new PreconsolidationStress(
                                                ps.Location,
                                                MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPreconsolidationStress(ps).GetDesignValue()))
            .ToArray());
 }
Ejemplo n.º 6
0
 private static PersistableStress CreateYieldStress(IMacroStabilityInwardsPreconsolidationStress preconsolidationStress)
 {
     return(new PersistableStress
     {
         YieldStress = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPreconsolidationStress(preconsolidationStress).GetDesignValue(),
         StateType = PersistableStateType.YieldStress
     });
 }
Ejemplo n.º 7
0
 private static PersistableStress CreatePOPStress(MacroStabilityInwardsSoilLayerData layerData)
 {
     return(new PersistableStress
     {
         Pop = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPop(layerData).GetDesignValue(),
         PopStochasticParameter = PersistableStochasticParameterFactory.Create(layerData.Pop),
         StateType = PersistableStateType.Pop
     });
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Asserts whether <paramref name="actual"/> corresponds to <paramref name="original"/>.
 /// </summary>
 /// <param name="original">The original <see cref="IMacroStabilityInwardsPreconsolidationStress"/> array.</param>
 /// <param name="actual">The actual <see cref="PreconsolidationStress"/> array.</param>
 /// <exception cref="AssertionException">Thrown when <paramref name="actual"/>
 /// does not correspond to <paramref name="original"/>.</exception>
 private static void AssertPreconsolidationStresses(IMacroStabilityInwardsPreconsolidationStress[] original,
                                                    PreconsolidationStress[] actual)
 {
     Assert.AreEqual(original.Length, actual.Length);
     for (var i = 0; i < original.Length; i++)
     {
         Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPreconsolidationStress(original[i]).GetDesignValue(), actual[i].Stress);
         Assert.AreSame(original[i].Location, actual[i].Coordinate);
     }
 }
Ejemplo n.º 9
0
        public void SetData_WithData_ExpectedValuesInTable()
        {
            // Setup
            using (var table = new MacroStabilityInwardsSoilLayerDataTable())
            {
                MacroStabilityInwardsSoilLayerData[] layers =
                {
                    CreateMacroStabilityInwardsSoilLayerData(),
                    CreateMacroStabilityInwardsSoilLayerData(),
                    CreateMacroStabilityInwardsSoilLayerData()
                };
                table.SetData(new[]
                {
                    new MacroStabilityInwardsSoilLayerData()
                });

                // Call
                table.SetData(layers);

                // Assert
                Assert.AreEqual(layers.Length, table.Rows.Count);
                for (var i = 0; i < table.Rows.Count; i++)
                {
                    MacroStabilityInwardsSoilLayerData soilLayerData = layers[i];
                    DataGridViewCellCollection         rowCells      = table.Rows[i].Cells;
                    Assert.AreEqual(soilLayerData.MaterialName,
                                    rowCells[nameColumnIndex].Value);
                    Assert.AreEqual(soilLayerData.Color,
                                    rowCells[colorColumnIndex].Value);
                    Assert.AreEqual(soilLayerData.IsAquifer,
                                    rowCells[isAquiferColumnIndex].Value);
                    AssertShiftedDesignVariableColumnValueEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetAbovePhreaticLevel(soilLayerData),
                                                                rowCells[abovePhreaticLevelColumnIndex].Value);
                    AssertShiftedDesignVariableColumnValueEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetBelowPhreaticLevel(soilLayerData),
                                                                rowCells[belowPhreaticLevelColumnIndex].Value);
                    Assert.AreEqual(soilLayerData.ShearStrengthModel,
                                    rowCells[shearStrengthModelColumnIndex].Value);
                    AssertDesignVariableColumnValueEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetCohesion(soilLayerData),
                                                         rowCells[cohesionColumnIndex].Value);
                    AssertDesignVariableColumnValueEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetFrictionAngle(soilLayerData),
                                                         rowCells[frictionAngleColumnIndex].Value);
                    AssertDesignVariableColumnValueEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetShearStrengthRatio(soilLayerData),
                                                         rowCells[shrearStrengthRatioColumnIndex].Value);
                    AssertDesignVariableColumnValueEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetStrengthIncreaseExponent(soilLayerData),
                                                         rowCells[strengthIncreaseExponentColumnIndex].Value);
                    Assert.AreEqual(soilLayerData.UsePop,
                                    rowCells[usePopColumnIndex].Value);
                    AssertDesignVariableColumnValueEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPop(soilLayerData),
                                                         rowCells[popColumnIndex].Value);
                }
            }
        }
        /// <summary>
        /// Asserts whether the <see cref="PersistableSoil"/> contains the data
        /// that is representative for the <paramref name="originalLayers"/>.
        /// </summary>
        /// <param name="originalLayers">The layers that contain the original data.</param>
        /// <param name="actualSoils">The collection of <see cref="PersistableSoil"/>
        /// that needs to be asserted.</param>
        /// <exception cref="AssertionException">Thrown when the data in <paramref name="actualSoils"/>
        /// is not correct.</exception>
        public static void AssertPersistableSoils(IEnumerable <IMacroStabilityInwardsSoilLayer> originalLayers, IEnumerable <PersistableSoil> actualSoils)
        {
            Assert.AreEqual(originalLayers.Count(), actualSoils.Count());

            for (var i = 0; i < originalLayers.Count(); i++)
            {
                PersistableSoil soil = actualSoils.ElementAt(i);
                MacroStabilityInwardsSoilLayerData layerData = originalLayers.ElementAt(i).Data;

                Assert.IsNotNull(soil.Id);
                Assert.AreEqual(layerData.MaterialName, soil.Name);
                Assert.AreEqual($"{layerData.MaterialName}-{soil.Id}", soil.Code);
                Assert.IsTrue(soil.IsProbabilistic);

                Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetCohesion(layerData).GetDesignValue(), soil.Cohesion);
                AssertStochasticParameter(layerData.Cohesion, soil.CohesionStochasticParameter);

                Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetFrictionAngle(layerData).GetDesignValue(), soil.FrictionAngle);
                AssertStochasticParameter(layerData.FrictionAngle, soil.FrictionAngleStochasticParameter);

                Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetShearStrengthRatio(layerData).GetDesignValue(), soil.ShearStrengthRatio);
                AssertStochasticParameter(layerData.ShearStrengthRatio, soil.ShearStrengthRatioStochasticParameter);

                Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetStrengthIncreaseExponent(layerData).GetDesignValue(), soil.StrengthIncreaseExponent);
                AssertStochasticParameter(layerData.StrengthIncreaseExponent, soil.StrengthIncreaseExponentStochasticParameter);

                Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetAbovePhreaticLevel(layerData).GetDesignValue(), soil.VolumetricWeightAbovePhreaticLevel);
                Assert.AreEqual(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetBelowPhreaticLevel(layerData).GetDesignValue(), soil.VolumetricWeightBelowPhreaticLevel);

                Assert.IsFalse(soil.CohesionAndFrictionAngleCorrelated);
                Assert.IsFalse(soil.ShearStrengthRatioAndShearStrengthExponentCorrelated);

                Assert.AreEqual(GetExpectedShearStrengthModelTypeForAbovePhreaticLevel(layerData.ShearStrengthModel), soil.ShearStrengthModelTypeAbovePhreaticLevel);
                Assert.AreEqual(GetExpectedShearStrengthModelTypeForBelowPhreaticLevel(layerData.ShearStrengthModel), soil.ShearStrengthModelTypeBelowPhreaticLevel);

                var dilatancyDistribution = new VariationCoefficientNormalDistribution(2)
                {
                    Mean = (RoundedDouble)1,
                    CoefficientOfVariation = (RoundedDouble)0
                };

                Assert.AreEqual(0, soil.Dilatancy);
                AssertStochasticParameter(dilatancyDistribution, soil.DilatancyStochasticParameter, false);
            }
        }
        public void GetPreconsolidationStress_ValidPreconsolidationStress_CreateDesignVariableForPreconsolidationStress()
        {
            // Setup
            var location           = new Point2D(random.NextDouble(), random.NextDouble());
            var stressDistribution = new VariationCoefficientLogNormalDistribution
            {
                Mean = (RoundedDouble)0.005,
                CoefficientOfVariation = (RoundedDouble)coefficientOfVariation
            };

            var preconsolidationStress = new MacroStabilityInwardsPreconsolidationStress(location, stressDistribution);

            // Call
            VariationCoefficientDesignVariable <VariationCoefficientLogNormalDistribution> preconsoldationStress =
                MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPreconsolidationStress(preconsolidationStress);

            // Assert
            DistributionAssert.AreEqual(preconsolidationStress.Stress, preconsoldationStress.Distribution);
            AssertPercentile(0.05, preconsoldationStress);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Creates a new instance of <see cref="MacroStabilityInwardsFormattedSoilLayerDataRow"/>.
        /// </summary>
        /// <param name="layerData">The <see cref="MacroStabilityInwardsSoilLayerData"/> to format.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="layerData"/>
        /// is <c>null</c>.</exception>
        public MacroStabilityInwardsFormattedSoilLayerDataRow(MacroStabilityInwardsSoilLayerData layerData)
        {
            if (layerData == null)
            {
                throw new ArgumentNullException(nameof(layerData));
            }

            MaterialName             = SoilLayerDataHelper.GetValidName(layerData.MaterialName);
            Color                    = SoilLayerDataHelper.GetValidColor(layerData.Color);
            IsAquifer                = layerData.IsAquifer;
            AbovePhreaticLevel       = FormatVariationCoefficientDesignVariableWithShift(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetAbovePhreaticLevel(layerData));
            BelowPhreaticLevel       = FormatVariationCoefficientDesignVariableWithShift(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetBelowPhreaticLevel(layerData));
            ShearStrengthModel       = layerData.ShearStrengthModel;
            Cohesion                 = FormatVariationCoefficientDesignVariable(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetCohesion(layerData));
            FrictionAngle            = FormatVariationCoefficientDesignVariable(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetFrictionAngle(layerData));
            ShearStrengthRatio       = FormatVariationCoefficientDesignVariable(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetShearStrengthRatio(layerData));
            StrengthIncreaseExponent = FormatVariationCoefficientDesignVariable(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetStrengthIncreaseExponent(layerData));
            UsePop                   = layerData.UsePop;
            Pop = FormatVariationCoefficientDesignVariable(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPop(layerData));
        }
        /// <summary>
        /// Creates a new instance of <see cref="PersistableSoil"/>.
        /// </summary>
        /// <param name="layer">The layer to use.</param>
        /// <param name="idFactory">The factory for creating IDs.</param>
        /// <param name="registry">The persistence registry.</param>
        /// <returns>The created <see cref="PersistableSoil"/>.</returns>
        /// <exception cref="InvalidEnumArgumentException">Thrown when
        /// <see cref="MacroStabilityInwardsShearStrengthModel"/> has an invalid value.</exception>
        /// <exception cref="NotSupportedException">Thrown when <see cref="MacroStabilityInwardsShearStrengthModel"/>
        /// has a valid value but is not supported.</exception>
        private static PersistableSoil Create(MacroStabilityInwardsSoilLayer2D layer, IdFactory idFactory, MacroStabilityInwardsExportRegistry registry)
        {
            MacroStabilityInwardsSoilLayerData layerData = layer.Data;

            var soil = new PersistableSoil
            {
                Id                                                   = idFactory.Create(),
                Name                                                 = layerData.MaterialName,
                IsProbabilistic                                      = true,
                Cohesion                                             = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetCohesion(layerData).GetDesignValue(),
                CohesionStochasticParameter                          = PersistableStochasticParameterFactory.Create(layerData.Cohesion),
                FrictionAngle                                        = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetFrictionAngle(layerData).GetDesignValue(),
                FrictionAngleStochasticParameter                     = PersistableStochasticParameterFactory.Create(layerData.FrictionAngle),
                ShearStrengthRatio                                   = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetShearStrengthRatio(layerData).GetDesignValue(),
                ShearStrengthRatioStochasticParameter                = PersistableStochasticParameterFactory.Create(layerData.ShearStrengthRatio),
                StrengthIncreaseExponent                             = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetStrengthIncreaseExponent(layerData).GetDesignValue(),
                StrengthIncreaseExponentStochasticParameter          = PersistableStochasticParameterFactory.Create(layerData.StrengthIncreaseExponent),
                CohesionAndFrictionAngleCorrelated                   = false,
                ShearStrengthRatioAndShearStrengthExponentCorrelated = false,
                ShearStrengthModelTypeAbovePhreaticLevel             = GetShearStrengthModelTypeForAbovePhreaticLevel(layerData.ShearStrengthModel),
                ShearStrengthModelTypeBelowPhreaticLevel             = GetShearStrengthModelTypeForBelowPhreaticLevel(layerData.ShearStrengthModel),
                VolumetricWeightAbovePhreaticLevel                   = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetAbovePhreaticLevel(layerData).GetDesignValue(),
                VolumetricWeightBelowPhreaticLevel                   = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetBelowPhreaticLevel(layerData).GetDesignValue(),
                Dilatancy                                            = 0,
                DilatancyStochasticParameter                         = PersistableStochasticParameterFactory.Create(new VariationCoefficientNormalDistribution(2)
                {
                    Mean = (RoundedDouble)1,
                    CoefficientOfVariation = (RoundedDouble)0
                }, false)
            };

            soil.Code = $"{soil.Name}-{soil.Id}";

            registry.AddSoil(layer, soil.Id);

            return(soil);
        }
        public void GetCohesion_ValidSoilLayerData_CreateDesignVariableForCohesion()
        {
            // Setup
            var data = new MacroStabilityInwardsSoilLayerData
            {
                Cohesion =
                {
                    Mean                   = (RoundedDouble)mean,
                    CoefficientOfVariation = (RoundedDouble)coefficientOfVariation
                }
            };

            // Call
            VariationCoefficientDesignVariable <VariationCoefficientLogNormalDistribution> cohesion = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetCohesion(data);

            // Assert
            DistributionAssert.AreEqual(data.Cohesion, cohesion.Distribution);
            AssertPercentile(0.05, cohesion);
        }
        public void GetBelowPhreaticLevel_ValidSoilLayerData_CreateDesignVariableForBelowPhreaticLevel()
        {
            // Setup
            var data = new MacroStabilityInwardsSoilLayerData
            {
                BelowPhreaticLevel =
                {
                    Mean                   = (RoundedDouble)mean,
                    CoefficientOfVariation = (RoundedDouble)coefficientOfVariation,
                    Shift                  = (RoundedDouble)(mean - 0.1)
                }
            };

            // Call
            VariationCoefficientDeterministicDesignVariable <VariationCoefficientLogNormalDistribution> belowPhreaticLevel = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetBelowPhreaticLevel(data);

            // Assert
            DistributionAssert.AreEqual(data.BelowPhreaticLevel, belowPhreaticLevel.Distribution);
            Assert.AreEqual(data.BelowPhreaticLevel.Mean, belowPhreaticLevel.GetDesignValue());
        }
        public void GetStrengthIncreaseExponent_ValidSoilLayerData_CreateDesignVariableForStrengthIncreaseExponent()
        {
            // Setup
            var data = new MacroStabilityInwardsSoilLayerData
            {
                StrengthIncreaseExponent =
                {
                    Mean                   = (RoundedDouble)mean,
                    CoefficientOfVariation = (RoundedDouble)coefficientOfVariation
                }
            };

            // Call
            VariationCoefficientDesignVariable <VariationCoefficientLogNormalDistribution> strengthIncreaseExponent = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetStrengthIncreaseExponent(data);

            // Assert
            DistributionAssert.AreEqual(data.StrengthIncreaseExponent, strengthIncreaseExponent.Distribution);
            AssertPercentile(0.05, strengthIncreaseExponent);
        }