private static PersistableStress CreatePOPStress(MacroStabilityInwardsSoilLayerData layerData) { return(new PersistableStress { Pop = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPop(layerData).GetDesignValue(), PopStochasticParameter = PersistableStochasticParameterFactory.Create(layerData.Pop), StateType = PersistableStateType.Pop }); }
/// <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); }