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);
            }
        }
 private static IEnumerable <PreconsolidationStress> ConvertPreconsolidationStresses(
     IEnumerable <IMacroStabilityInwardsPreconsolidationStress> preconsolidationStresses)
 {
     return(preconsolidationStresses.Select(ps => new PreconsolidationStress(
                                                ps.Location,
                                                MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPreconsolidationStress(ps).GetDesignValue()))
            .ToArray());
 }
 private static PersistableStress CreateYieldStress(IMacroStabilityInwardsPreconsolidationStress preconsolidationStress)
 {
     return(new PersistableStress
     {
         YieldStress = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPreconsolidationStress(preconsolidationStress).GetDesignValue(),
         StateType = PersistableStateType.YieldStress
     });
 }
 /// <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);
     }
 }
        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);
        }