コード例 #1
0
        public void HasValidStatePoints_SoilProfileWithPOPAndPreconsolidationStressOnOneLayer_ReturnsFalse()
        {
            // Setup
            MacroStabilityInwardsStochasticSoilProfile stochasticSoilProfile = MacroStabilityInwardsStochasticSoilProfileTestFactory.CreateMacroStabilityInwardsStochasticSoilProfile2D(new[]
            {
                MacroStabilityInwardsPreconsolidationStressTestFactory.CreateMacroStabilityInwardsPreconsolidationStress(new Point2D(2, 1))
            });

            IMacroStabilityInwardsSoilLayer firstLayer = stochasticSoilProfile.SoilProfile.Layers.First();

            firstLayer.Data.UsePop = true;
            firstLayer.Data.Pop    = new VariationCoefficientLogNormalDistribution
            {
                Mean = (RoundedDouble)1,
                CoefficientOfVariation = (RoundedDouble)2
            };

            MacroStabilityInwardsSoilProfileUnderSurfaceLine soilProfileUnderSurfaceLine = MacroStabilityInwardsSoilProfileUnderSurfaceLineFactory.Create(stochasticSoilProfile.SoilProfile,
                                                                                                                                                          CreateSurfaceLine());

            // Call
            bool hasValidStatePoints = PersistableStateHelper.HasValidStatePoints(soilProfileUnderSurfaceLine);

            // Assert
            Assert.IsFalse(hasValidStatePoints);
        }
コード例 #2
0
        public void HasValidStatePoints_SoilProfileNull_ThrowsArgumentNullException()
        {
            // Call
            void Call() => PersistableStateHelper.HasValidStatePoints(null);

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(Call);

            Assert.AreEqual("soilProfile", exception.ParamName);
        }
コード例 #3
0
        public void HasValidStatePoints_SoilProfileWithPreconsolidationStressOutsideLayers_ReturnsFalse()
        {
            // Setup
            MacroStabilityInwardsStochasticSoilProfile stochasticSoilProfile = MacroStabilityInwardsStochasticSoilProfileTestFactory.CreateMacroStabilityInwardsStochasticSoilProfile2D(new[]
            {
                MacroStabilityInwardsPreconsolidationStressTestFactory.CreateMacroStabilityInwardsPreconsolidationStress(new Point2D(2, -50))
            });

            MacroStabilityInwardsSoilProfileUnderSurfaceLine soilProfileUnderSurfaceLine = MacroStabilityInwardsSoilProfileUnderSurfaceLineFactory.Create(stochasticSoilProfile.SoilProfile, CreateSurfaceLine());

            // Call
            bool hasValidStatePoints = PersistableStateHelper.HasValidStatePoints(soilProfileUnderSurfaceLine);

            // Assert
            Assert.IsFalse(hasValidStatePoints);
        }
コード例 #4
0
        private void ValidateData()
        {
            if (Math.Abs(calculation.InputParameters.MaximumSliceWidth - 1) > 1e-3)
            {
                LogWarning(string.Format(Resources.MacroStabilityInwardsCalculationExporter_ValidateData_DGeoSuite_only_supports_MaximumSliceWidth_one_but_calculation_has_MaximumSliceWidth_0,
                                         calculation.InputParameters.MaximumSliceWidth.ToString(null, CultureInfo.CurrentCulture)));
            }

            MacroStabilityInwardsSoilLayer2D[] layers = MacroStabilityInwardsSoilProfile2DLayersHelper.GetLayersRecursively(calculation.InputParameters.SoilProfileUnderSurfaceLine.Layers).ToArray();
            if (layers.Count(l => l.Data.IsAquifer) > 1)
            {
                LogWarning(Resources.MacroStabilityInwardsCalculationExporter_ValidateData_Multiple_aquifer_layers_not_supported_no_aquifer_layer_exported);
            }

            if (!PersistableStateHelper.HasValidStatePoints(calculation.InputParameters.SoilProfileUnderSurfaceLine))
            {
                LogWarning(Resources.MacroStabilityInwardsCalculationExporter_ValidateData_Multiple_stress_points_not_supported_no_stress_points_exported);
            }
        }
コード例 #5
0
        private static PersistableState Create(IMacroStabilityInwardsSoilProfileUnderSurfaceLine soilProfile, MacroStabilityInwardsExportStageType stageType,
                                               IdFactory idFactory, MacroStabilityInwardsExportRegistry registry)
        {
            MacroStabilityInwardsSoilLayer2D[] layers = MacroStabilityInwardsSoilProfile2DLayersHelper.GetLayersRecursively(soilProfile.Layers).ToArray();

            var statePoints = new List <PersistableStatePoint>();

            if (PersistableStateHelper.HasValidStatePoints(soilProfile))
            {
                statePoints.AddRange(layers.Where(l => l.Data.UsePop && PersistableStateHelper.HasValidPop(l.Data.Pop))
                                     .Select(l => CreatePOPStatePoint(l, stageType, idFactory, registry))
                                     .ToArray());

                var preconsolidationStressPoints = new List <PersistableStatePoint>();

                foreach (IMacroStabilityInwardsPreconsolidationStress preconsolidationStress in soilProfile.PreconsolidationStresses)
                {
                    MacroStabilityInwardsSoilLayer2D layer = PersistableStateHelper.GetLayerForPreconsolidationStress(layers, preconsolidationStress);
                    if (layer != null)
                    {
                        preconsolidationStressPoints.Add(
                            CreateYieldStressStatePoint(layer, preconsolidationStress, stageType, idFactory, registry));
                    }
                }

                statePoints.AddRange(preconsolidationStressPoints);
            }

            var state = new PersistableState
            {
                Id          = idFactory.Create(),
                StateLines  = Enumerable.Empty <PersistableStateLine>(),
                StatePoints = statePoints
            };

            registry.AddState(stageType, state.Id);

            return(state);
        }