/// <summary>
        /// Creates a new instance of <see cref="PersistableSoilCollection"/>.
        /// </summary>
        /// <param name="soilProfile">The soil profile to use.</param>
        /// <param name="idFactory">The factory for creating IDs.</param>
        /// <param name="registry">The persistence registry.</param>
        /// <returns>The created <see cref="PersistableSoilCollection"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception>
        /// <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>
        public static PersistableSoilCollection Create(IMacroStabilityInwardsSoilProfileUnderSurfaceLine soilProfile,
                                                       IdFactory idFactory, MacroStabilityInwardsExportRegistry registry)
        {
            if (soilProfile == null)
            {
                throw new ArgumentNullException(nameof(soilProfile));
            }

            if (idFactory == null)
            {
                throw new ArgumentNullException(nameof(idFactory));
            }

            if (registry == null)
            {
                throw new ArgumentNullException(nameof(registry));
            }

            return(new PersistableSoilCollection
            {
                Soils = MacroStabilityInwardsSoilProfile2DLayersHelper.GetLayersRecursively(soilProfile.Layers)
                        .Select(l => Create(l, idFactory, registry))
                        .ToArray()
            });
        }
示例#2
0
 private static PersistableSoilLayer Create(MacroStabilityInwardsSoilLayer2D layer, MacroStabilityInwardsExportStageType stageType,
                                            MacroStabilityInwardsExportRegistry registry)
 {
     return(new PersistableSoilLayer
     {
         LayerId = registry.GeometryLayers[stageType][layer],
         SoilId = registry.Soils[layer]
     });
 }
        private static PersistableCalculationSettings Create(IdFactory idFactory, MacroStabilityInwardsExportRegistry registry,
                                                             MacroStabilityInwardsExportStageType stageType)
        {
            var settings = new PersistableCalculationSettings
            {
                Id = idFactory.Create()
            };

            registry.AddSettings(stageType, settings.Id);
            return(settings);
        }
        private static PersistableLayer CreateLayer(MacroStabilityInwardsSoilLayer2D layer, MacroStabilityInwardsExportStageType stageType,
                                                    IdFactory idFactory, MacroStabilityInwardsExportRegistry registry)
        {
            var persistableLayer = new PersistableLayer
            {
                Id     = idFactory.Create(),
                Label  = layer.Data.MaterialName,
                Points = layer.OuterRing.Points.Select(p => new PersistablePoint(p.X, p.Y)).ToArray()
            };

            registry.AddGeometryLayer(stageType, layer, persistableLayer.Id);
            return(persistableLayer);
        }
        private static PersistableGeometry CreateGeometry(IMacroStabilityInwardsSoilProfileUnderSurfaceLine soilProfile, MacroStabilityInwardsExportStageType stageType,
                                                          IdFactory idFactory, MacroStabilityInwardsExportRegistry registry)
        {
            var geometry = new PersistableGeometry
            {
                Id     = idFactory.Create(),
                Layers = MacroStabilityInwardsSoilProfile2DLayersHelper.GetLayersRecursively(soilProfile.Layers)
                         .Select(l => CreateLayer(l, stageType, idFactory, registry))
                         .ToArray()
            };

            registry.AddGeometry(stageType, geometry.Id);

            return(geometry);
        }
        /// <summary>
        /// Creates a new <see cref="PersistableDataModel"/>.
        /// </summary>
        /// <param name="calculation">The calculation to get the data from.</param>
        /// <param name="generalInput">General calculation parameters that are the same across all calculations.</param>
        /// <param name="getNormativeAssessmentLevelFunc"><see cref="Func{TResult}"/>
        /// for obtaining the normative assessment level.</param>
        /// <param name="filePath">The filePath that is used.</param>
        /// <returns>A created <see cref="PersistableDataModel"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="calculation"/>,
        /// <paramref name="generalInput"/> or <paramref name="getNormativeAssessmentLevelFunc"/> is <c>null</c>.</exception>
        /// <exception cref="InvalidOperationException">Thrown when <paramref name="calculation"/>
        /// has no output.</exception>
        public static PersistableDataModel Create(MacroStabilityInwardsCalculation calculation,
                                                  GeneralMacroStabilityInwardsInput generalInput,
                                                  Func <RoundedDouble> getNormativeAssessmentLevelFunc,
                                                  string filePath)
        {
            if (calculation == null)
            {
                throw new ArgumentNullException(nameof(calculation));
            }

            if (generalInput == null)
            {
                throw new ArgumentNullException(nameof(generalInput));
            }

            if (getNormativeAssessmentLevelFunc == null)
            {
                throw new ArgumentNullException(nameof(getNormativeAssessmentLevelFunc));
            }

            if (!calculation.HasOutput)
            {
                throw new InvalidOperationException("Calculation must have output.");
            }

            var idFactory = new IdFactory();
            var registry  = new MacroStabilityInwardsExportRegistry();

            MacroStabilityInwardsInput input = calculation.InputParameters;
            IMacroStabilityInwardsSoilProfileUnderSurfaceLine soilProfile = input.SoilProfileUnderSurfaceLine;

            return(new PersistableDataModel
            {
                Info = PersistableProjectInfoFactory.Create(calculation, filePath),
                CalculationSettings = PersistableCalculationSettingsFactory.Create(calculation.Output.SlidingCurve, idFactory, registry),
                Soils = PersistableSoilCollectionFactory.Create(soilProfile, idFactory, registry),
                Geometry = PersistableGeometryFactory.Create(soilProfile, idFactory, registry),
                SoilLayers = PersistableSoilLayerCollectionFactory.Create(soilProfile, idFactory, registry),
                Waternets = PersistableWaternetFactory.Create(
                    DerivedMacroStabilityInwardsInput.GetWaternetDaily(input, generalInput),
                    DerivedMacroStabilityInwardsInput.GetWaternetExtreme(input, generalInput, GetEffectiveAssessmentLevel(input, getNormativeAssessmentLevelFunc)),
                    generalInput, idFactory, registry),
                WaternetCreatorSettings = PersistableWaternetCreatorSettingsFactory.Create(input, GetEffectiveAssessmentLevel(input, getNormativeAssessmentLevelFunc),
                                                                                           idFactory, registry),
                States = PersistableStateFactory.Create(soilProfile, idFactory, registry),
                Stages = PersistableStageFactory.Create(idFactory, registry)
            });
        }
示例#7
0
        private static PersistableSoilLayerCollection CreateSoilLayerCollection(IMacroStabilityInwardsSoilProfileUnderSurfaceLine soilProfile,
                                                                                MacroStabilityInwardsExportStageType stageType, IdFactory idFactory,
                                                                                MacroStabilityInwardsExportRegistry registry)
        {
            var soilLayerCollection = new PersistableSoilLayerCollection
            {
                Id         = idFactory.Create(),
                SoilLayers = MacroStabilityInwardsSoilProfile2DLayersHelper.GetLayersRecursively(soilProfile.Layers)
                             .Select(l => Create(l, stageType, registry))
                             .ToArray()
            };

            registry.AddSoilLayer(stageType, soilLayerCollection.Id);

            return(soilLayerCollection);
        }
示例#8
0
 private static PersistableStage Create(MacroStabilityInwardsExportStageType stageType, string label,
                                        IdFactory idFactory, MacroStabilityInwardsExportRegistry registry)
 {
     return(new PersistableStage
     {
         Id = idFactory.Create(),
         Label = label,
         CalculationSettingsId = registry.Settings[stageType],
         GeometryId = registry.Geometries[stageType],
         SoilLayersId = registry.SoilLayers[stageType],
         WaternetId = registry.Waternets[stageType],
         WaternetCreatorSettingsId = registry.WaternetCreatorSettings[stageType],
         StateId = stageType == MacroStabilityInwardsExportStageType.Daily
                       ? registry.States[stageType]
                       : null
     });
 }
示例#9
0
        /// <summary>
        /// Creates a collection of <see cref="PersistableStage"/>.
        /// </summary>
        /// <param name="idFactory">The factory for creating IDs.</param>
        /// <param name="registry">The persistence registry.</param>
        /// <returns>A collection of <see cref="PersistableStage"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any parameter
        /// is <c>null</c>.</exception>
        public static IEnumerable <PersistableStage> Create(IdFactory idFactory, MacroStabilityInwardsExportRegistry registry)
        {
            if (idFactory == null)
            {
                throw new ArgumentNullException(nameof(idFactory));
            }

            if (registry == null)
            {
                throw new ArgumentNullException(nameof(registry));
            }

            return(new[]
            {
                Create(MacroStabilityInwardsExportStageType.Daily, MacroStabilityInwardsDataResources.Daily_DisplayName, idFactory, registry),
                Create(MacroStabilityInwardsExportStageType.Extreme, MacroStabilityInwardsDataResources.Extreme_DisplayName, idFactory, registry)
            });
        }
示例#10
0
        private static PersistableWaternet Create(MacroStabilityInwardsWaternet waternet, GeneralMacroStabilityInwardsInput generalInput, MacroStabilityInwardsExportStageType stageType,
                                                  IdFactory idFactory, MacroStabilityInwardsExportRegistry registry)
        {
            var persistableWaternet = new PersistableWaternet
            {
                Id = idFactory.Create(),
                UnitWeightWater = generalInput.WaterVolumetricWeight,
                HeadLines       = waternet.PhreaticLines.Select(pl => Create(pl, idFactory)).ToArray(),
                ReferenceLines  = waternet.WaternetLines.Select(wl => Create(wl, idFactory)).ToArray(),
                PhreaticLineId  = waternet.PhreaticLines.Any()
                                     ? createdHeadLines[waternet.PhreaticLines.First()].Id
                                     : null
            };

            registry.AddWaternet(stageType, persistableWaternet.Id);

            return(persistableWaternet);
        }
示例#11
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);
        }
示例#12
0
        /// <summary>
        /// Creates a new collection of <see cref="PersistableWaternet"/>.
        /// </summary>
        /// <param name="dailyWaternet">The daily Waternet to use.</param>
        /// <param name="extremeWaternet">The extreme Waternet to use.</param>
        /// <param name="generalInput">General calculation parameters that are the same across all calculations.</param>
        /// <param name="idFactory">The factory for creating IDs.</param>
        /// <param name="registry">The persistence registry.</param>
        /// <returns>A collection of <see cref="PersistableWaternet"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception>
        public static IEnumerable <PersistableWaternet> Create(MacroStabilityInwardsWaternet dailyWaternet,
                                                               MacroStabilityInwardsWaternet extremeWaternet,
                                                               GeneralMacroStabilityInwardsInput generalInput,
                                                               IdFactory idFactory,
                                                               MacroStabilityInwardsExportRegistry registry)
        {
            if (dailyWaternet == null)
            {
                throw new ArgumentNullException(nameof(dailyWaternet));
            }

            if (extremeWaternet == null)
            {
                throw new ArgumentNullException(nameof(extremeWaternet));
            }

            if (idFactory == null)
            {
                throw new ArgumentNullException(nameof(idFactory));
            }

            if (registry == null)
            {
                throw new ArgumentNullException(nameof(registry));
            }

            if (generalInput == null)
            {
                throw new ArgumentNullException(nameof(generalInput));
            }

            createdHeadLines = new Dictionary <MacroStabilityInwardsPhreaticLine, PersistableHeadLine>(new PhreaticLineComparer());

            return(new[]
            {
                Create(dailyWaternet, generalInput, MacroStabilityInwardsExportStageType.Daily, idFactory, registry),
                Create(extremeWaternet, generalInput, MacroStabilityInwardsExportStageType.Extreme, idFactory, registry)
            });
        }
示例#13
0
        /// <summary>
        /// Creates a new collection of <see cref="PersistableState"/>.
        /// </summary>
        /// <param name="soilProfile">The soil profile to use.</param>
        /// <param name="idFactory">The factory for creating IDs.</param>
        /// <param name="registry">The persistence registry.</param>
        /// <returns>A collection of <see cref="PersistableState"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception>
        public static IEnumerable <PersistableState> Create(IMacroStabilityInwardsSoilProfileUnderSurfaceLine soilProfile,
                                                            IdFactory idFactory, MacroStabilityInwardsExportRegistry registry)
        {
            if (soilProfile == null)
            {
                throw new ArgumentNullException(nameof(soilProfile));
            }

            if (idFactory == null)
            {
                throw new ArgumentNullException(nameof(idFactory));
            }

            if (registry == null)
            {
                throw new ArgumentNullException(nameof(registry));
            }

            return(new[]
            {
                Create(soilProfile, MacroStabilityInwardsExportStageType.Daily, idFactory, registry)
            });
        }
示例#14
0
        /// <summary>
        /// Creates a new <see cref="PersistableWaternetCreatorSettings"/> for extreme.
        /// </summary>
        /// <param name="input">The input to use.</param>
        /// <param name="normativeAssessmentLevel">The normative assessment level to use.</param>
        /// <param name="idFactory">The factory for creating IDs.</param>
        /// <param name="registry">The persistence registry.</param>
        /// <returns>The created <see cref="PersistableWaternetCreatorSettings"/>.</returns>
        /// <exception cref="InvalidEnumArgumentException">Thrown when <see cref="IMacroStabilityInwardsWaternetInput.DikeSoilScenario"/>
        /// has an invalid value for <see cref="MacroStabilityInwardsDikeSoilScenario"/>.</exception>
        /// <exception cref="NotSupportedException">Thrown when <see cref="IMacroStabilityInwardsWaternetInput.DikeSoilScenario"/>
        /// is not supported.</exception>
        private static PersistableWaternetCreatorSettings CreateExtreme(IMacroStabilityInwardsWaternetInput input, RoundedDouble normativeAssessmentLevel,
                                                                        IdFactory idFactory, MacroStabilityInwardsExportRegistry registry)
        {
            PersistableWaternetCreatorSettings waternetCreatorSettings = Create(input, idFactory, registry, MacroStabilityInwardsExportStageType.Extreme);

            waternetCreatorSettings.NormativeWaterLevel  = normativeAssessmentLevel;
            waternetCreatorSettings.WaterLevelHinterland = input.LocationInputExtreme.WaterLevelPolder;
            SetOffsets(input.LocationInputExtreme, waternetCreatorSettings);
            waternetCreatorSettings.IntrusionLength = input.LocationInputExtreme.PenetrationLength;

            return(waternetCreatorSettings);
        }
示例#15
0
        /// <summary>
        /// Creates a new <see cref="PersistableWaternetCreatorSettings"/> for daily.
        /// </summary>
        /// <param name="input">The input to use.</param>
        /// <param name="idFactory">The factory for creating IDs.</param>
        /// <param name="registry">The persistence registry.</param>
        /// <returns>The created <see cref="PersistableWaternetCreatorSettings"/>.</returns>
        /// <exception cref="InvalidEnumArgumentException">Thrown when <see cref="IMacroStabilityInwardsWaternetInput.DikeSoilScenario"/>
        /// has an invalid value for <see cref="MacroStabilityInwardsDikeSoilScenario"/>.</exception>
        /// <exception cref="NotSupportedException">Thrown when <see cref="IMacroStabilityInwardsWaternetInput.DikeSoilScenario"/>
        /// is not supported.</exception>
        private static PersistableWaternetCreatorSettings CreateDaily(IMacroStabilityInwardsWaternetInput input, IdFactory idFactory, MacroStabilityInwardsExportRegistry registry)
        {
            PersistableWaternetCreatorSettings waternetCreatorSettings = Create(input, idFactory, registry, MacroStabilityInwardsExportStageType.Daily);

            waternetCreatorSettings.NormativeWaterLevel  = input.WaterLevelRiverAverage;
            waternetCreatorSettings.WaterLevelHinterland = input.LocationInputDaily.WaterLevelPolder;
            SetOffsets(input.LocationInputDaily, waternetCreatorSettings);
            waternetCreatorSettings.IntrusionLength = input.LocationInputDaily.PenetrationLength;

            return(waternetCreatorSettings);
        }
示例#16
0
        /// <summary>
        /// Creates a new collection of <see cref="PersistableWaternetCreatorSettings"/>.
        /// </summary>
        /// <param name="input">The input to use.</param>
        /// <param name="normativeAssessmentLevel">The normative assessment level to use.</param>
        /// <param name="idFactory">The factory for creating IDs.</param>
        /// <param name="registry">The persistence registry.</param>
        /// <returns>A collection of <see cref="PersistableWaternetCreatorSettings"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="input"/>, <paramref name="idFactory"/>
        /// or <paramref name="registry"/> is <c>null</c>.</exception>
        /// <exception cref="InvalidEnumArgumentException">Thrown when <see cref="MacroStabilityInwardsInput.DikeSoilScenario"/>
        /// has an invalid value for <see cref="MacroStabilityInwardsDikeSoilScenario"/>.</exception>
        /// <exception cref="NotSupportedException">Thrown when <see cref="MacroStabilityInwardsInput.DikeSoilScenario"/>
        /// is not supported.</exception>
        public static IEnumerable <PersistableWaternetCreatorSettings> Create(MacroStabilityInwardsInput input, RoundedDouble normativeAssessmentLevel,
                                                                              IdFactory idFactory, MacroStabilityInwardsExportRegistry registry)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            if (idFactory == null)
            {
                throw new ArgumentNullException(nameof(idFactory));
            }

            if (registry == null)
            {
                throw new ArgumentNullException(nameof(registry));
            }

            return(new[]
            {
                CreateDaily(input, idFactory, registry),
                CreateExtreme(input, normativeAssessmentLevel, idFactory, registry)
            });
        }
        /// <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);
        }
示例#18
0
 private static PersistableStatePoint CreateYieldStressStatePoint(MacroStabilityInwardsSoilLayer2D layer, IMacroStabilityInwardsPreconsolidationStress preconsolidationStress,
                                                                  MacroStabilityInwardsExportStageType stageType, IdFactory idFactory, MacroStabilityInwardsExportRegistry registry)
 {
     return(new PersistableStatePoint
     {
         Id = idFactory.Create(),
         LayerId = registry.GeometryLayers[stageType][layer],
         IsProbabilistic = false,
         Point = new PersistablePoint(preconsolidationStress.Location.X, preconsolidationStress.Location.Y),
         Stress = CreateYieldStress(preconsolidationStress),
         Label = string.Format(Resources.PersistableStateFactory_CreateStatePoint_PreconsolidationStress_LayerName_0, layer.Data.MaterialName)
     });
 }
示例#19
0
        private static PersistableStatePoint CreatePOPStatePoint(MacroStabilityInwardsSoilLayer2D layer, MacroStabilityInwardsExportStageType stageType,
                                                                 IdFactory idFactory, MacroStabilityInwardsExportRegistry registry)
        {
            Point2D interiorPoint = AdvancedMath2D.GetPolygonInteriorPoint(layer.OuterRing.Points, layer.NestedLayers.Select(layers => layers.OuterRing.Points));

            return(new PersistableStatePoint
            {
                Id = idFactory.Create(),
                LayerId = registry.GeometryLayers[stageType][layer],
                IsProbabilistic = true,
                Point = new PersistablePoint(interiorPoint.X, interiorPoint.Y),
                Stress = CreatePOPStress(layer.Data),
                Label = string.Format(Resources.PersistableStateFactory_CreateStatePoint_POP_LayerName_0, layer.Data.MaterialName)
            });
        }
示例#20
0
        /// <summary>
        /// Creates a new <see cref="PersistableWaternetCreatorSettings"/>.
        /// </summary>
        /// <param name="input">The input to use.</param>
        /// <param name="idFactory">The factory for creating IDs.</param>
        /// <param name="registry">The persistence registry.</param>
        /// <param name="stageType">The stage type.</param>
        /// <returns>The created <see cref="PersistableWaternetCreatorSettings"/>.</returns>
        /// <exception cref="InvalidEnumArgumentException">Thrown when <see cref="IMacroStabilityInwardsWaternetInput.DikeSoilScenario"/>
        /// has an invalid value for <see cref="MacroStabilityInwardsDikeSoilScenario"/>.</exception>
        /// <exception cref="NotSupportedException">Thrown when <see cref="IMacroStabilityInwardsWaternetInput.DikeSoilScenario"/>
        /// is not supported.</exception>
        private static PersistableWaternetCreatorSettings Create(IMacroStabilityInwardsWaternetInput input, IdFactory idFactory, MacroStabilityInwardsExportRegistry registry,
                                                                 MacroStabilityInwardsExportStageType stageType)
        {
            bool isDitchPresent          = IsDitchPresent(input.SurfaceLine);
            var  waternetCreatorSettings = new PersistableWaternetCreatorSettings
            {
                Id = idFactory.Create(),
                InitialLevelEmbankmentTopWaterSide = input.MinimumLevelPhreaticLineAtDikeTopRiver,
                InitialLevelEmbankmentTopLandSide  = input.MinimumLevelPhreaticLineAtDikeTopPolder,
                AdjustForUplift = input.AdjustPhreaticLine3And4ForUplift,
                PleistoceneLeakageLengthOutwards = input.LeakageLengthOutwardsPhreaticLine3,
                PleistoceneLeakageLengthInwards  = input.LeakageLengthInwardsPhreaticLine3,
                AquiferLayerInsideAquitardLeakageLengthOutwards = input.LeakageLengthOutwardsPhreaticLine4,
                AquiferLayerInsideAquitardLeakageLengthInwards  = input.LeakageLengthInwardsPhreaticLine4,
                AquitardHeadWaterSide         = input.PiezometricHeadPhreaticLine2Outwards,
                AquitardHeadLandSide          = input.PiezometricHeadPhreaticLine2Inwards,
                MeanWaterLevel                = input.WaterLevelRiverAverage,
                IsDrainageConstructionPresent = input.DrainageConstructionPresent,
                DrainageConstruction          = new PersistablePoint(input.XCoordinateDrainageConstruction, input.ZCoordinateDrainageConstruction),
                IsDitchPresent                = isDitchPresent,
                DitchCharacteristics          = CreateDitchCharacteristics(input.SurfaceLine, isDitchPresent),
                EmbankmentCharacteristics     = CreateEmbankmentCharacteristics(input.SurfaceLine),
                EmbankmentSoilScenario        = CreateEmbankmentSoilScenario(input.DikeSoilScenario),
                IsAquiferLayerInsideAquitard  = false
            };

            IEnumerable <MacroStabilityInwardsSoilLayer2D> aquiferLayers = MacroStabilityInwardsSoilProfile2DLayersHelper.GetLayersRecursively(input.SoilProfileUnderSurfaceLine.Layers)
                                                                           .Where(l => l.Data.IsAquifer);

            if (aquiferLayers.Count() == 1)
            {
                waternetCreatorSettings.AquiferLayerId = registry.GeometryLayers[stageType][aquiferLayers.Single()];
            }

            registry.AddWaternetCreatorSettings(stageType, waternetCreatorSettings.Id);

            return(waternetCreatorSettings);
        }
        /// <summary>
        /// Creates a collection of <see cref="PersistableCalculationSettings"/>.
        /// </summary>
        /// <param name="slidingCurve">The sliding curve to use.</param>
        /// <param name="idFactory">The factory for creating IDs.</param>
        /// <param name="registry">The persistence registry.</param>
        /// <returns>A collection of <see cref="PersistableCalculationSettings"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception>
        public static IEnumerable <PersistableCalculationSettings> Create(MacroStabilityInwardsSlidingCurve slidingCurve, IdFactory idFactory, MacroStabilityInwardsExportRegistry registry)
        {
            if (slidingCurve == null)
            {
                throw new ArgumentNullException(nameof(slidingCurve));
            }

            if (idFactory == null)
            {
                throw new ArgumentNullException(nameof(idFactory));
            }

            if (registry == null)
            {
                throw new ArgumentNullException(nameof(registry));
            }

            PersistableCalculationSettings dailySettings   = Create(idFactory, registry, MacroStabilityInwardsExportStageType.Daily);
            PersistableCalculationSettings extremeSettings = Create(idFactory, registry, MacroStabilityInwardsExportStageType.Extreme);

            dailySettings.AnalysisType   = PersistableAnalysisType.UpliftVan;
            extremeSettings.AnalysisType = PersistableAnalysisType.UpliftVan;
            extremeSettings.UpliftVan    = new PersistableUpliftVanSettings
            {
                SlipPlane = new PersistableTwoCirclesOnTangentLine
                {
                    FirstCircleCenter = new PersistablePoint(slidingCurve.LeftCircle.Center.X,
                                                             slidingCurve.LeftCircle.Center.Y),
                    FirstCircleRadius  = slidingCurve.LeftCircle.Radius,
                    SecondCircleCenter = new PersistablePoint(slidingCurve.RightCircle.Center.X,
                                                              slidingCurve.RightCircle.Center.Y)
                }
            };
            extremeSettings.CalculationType = PersistableCalculationType.Deterministic;

            return(new[]
            {
                dailySettings,
                extremeSettings
            });
        }